I have a basic app with a list view with manualy added cells.
How would i make it so that when a cell is clicked , a specific date is added to the iphone calendar?
Info - using latest xcode with storyboards
You should have a delegate for you list view that response to the UITableViewDelegate protocol. By tableView:didSelectRowAtIndexPath: you can catch the click to your cell.
Then, use EKEventStore class to access your calendar. Your appointment is represented by an EKEvent.
EDIT
For more information you should consult the Introduction to Calendars and Reminders, Event Kit Framework Reference, and Table View Programming Guide.
This is the general approach, for a more detailed description you should tell, what your issues are and what did you try. Nobody at SO will write the program for you.
Related
Is there a convenient way to generate code from any new view controllers I've created on the storyboard? For example when you create a new iOS application, XCode will set up a skeleton class for your view controller.
Thanks!
I don't think so. You need to create a new ViewController subclass in XCode but uncheck the "Create Xib for this class" box (not sure if that is exactly what it says). Then select your newly made view controller in storyboard and change it to the class you just created.
Ok the skeleton you are talking about is just a template for your application. You are asking for a dynamic template generator from your storyboard and maybe Apple can figure out how to do this in a non distant future but in this moment I think you can't do that. After you created the storyboard file with your complex scheme you need to manually create all your viewController subclass you used in the storyboard. It's not a big deal ... I suppose your application doesn't have thousand ViewController so you can do it manually.
Apple are working hard to simplify developers job but Xcode can't do everything for you.
You can try to post this answer directly to Apple throughout the bugreport Apple website and post it as improvement to implement in future Xcode release.
Lets try it :)
I was using Xcode 4.1 and after upgrading to 4.2, things started to become out of date. I am using many examples from different books, such as Big Nerd Ranch Guides, which do not use Storyboards and the Windows-Based Application had been changed to "Empty" Application.
With these new changes, I feel like the books and tutorials I had been using to start have become outdated. In many of these examples, they say to write the methods and variables in the delegate header files for 4.1. With the new 4.2 Xcode, there is an AppDelegate and ViewController. Should I still be writing the methods and class members in the AppDelegate, or should I be now writing them in the Controller file?
I am confused. Does Apple now want us to create our controller and reference it through the delegate?
When your app is run, it creates an instance of UIApplication. You want to know things that only the UIApplication object knows (did we just get switched to the background? did we just open?) so you use the delegate pattern to get it. When you start a new project Apple starts you off with an already-assigned App Delegate. You can open up MainWindow.nib and inspect your App Delegate to see how it is connected to your UIApplication instance (File's Owner, in this case).
In general you only want to put code in there that has to do with the basic functionality of your app. Launch, quit, go to background and come to foreground are when you'll be doing things in the App Delegate.
Most everything else should go in your view controllers or model objects. Since 'delegate' is just a design pattern, your view controllers can be delegates of other objects. For example, if you present a UITableView, you will assign a view controller as it's delegate in order to respond to events such as selection and scrolling. Your app has many delegates, but it only has one App Delegate.
The AppDelegate is really just a "launcher" for your app. Ie: You shouldn't be writing much code in it at all.
If you're concerned with "set up" code, do it in your View Controller, under viewDidLoad.
Is the UITableViewCell subclass used in Apple's native Mail app available anywhere online?
Thanks.
Certainly not from Apple. Custom UITableViewCell classes are actually relatively simple to put together, and the one in Mail is not especially complex. Here's a great blog post on customizing these cells.
I don't think it is. But that is simple to do with IB. You can open your IB, drag in a new UITableViewCell and then customize it, link it back to the class code. Here is another Blog post that shows you how to do it and how to link it back to your class code
Using XCode's Navigational-based application project type, where is the code that loads the table view that is there by default?
There are a few delegate methods that compose your table view. Apple has a pretty good explanation with a sequence diagram that explains exactly how it is built and what each delegate method does: link text
Can anyone provide example of how to create contact view from address book.
Mostly I am interested in:
What UIKit class to use for Add Photo
What class to use for editing Name and Company
How to implement composite control where I am able to edit phone, ringtone
Thx
I'd recommend you check out the Address Book Programming guide for iPhone OS section at the iPhone Developer site.
The iPhone SDK comes with pre-built classes and views that can handle selecting, editing or adding of all the address book data. You simply create one of these pre-built controllers (e.g. ABPersonViewController) and fill in the ID of the person, and which details the user can select/change.
I've putted ImageView and a couple of TableViews with style set to Groped. I have one controller datasource for all my table views, that's why I set each table view tag property to unique int value to distinguish them in numberOfRowsInSection and cellForRowAtIndexPath.
Then everything is pretty standard, you are doing pushViewController and popViewControllerAnimated to show and hide details controller.
Works fine for me.
Apple's sample project QuickContacts covers this.