Upload
nabeelarif100
View
968
Download
4
Embed Size (px)
DESCRIPTION
Storyboarding is an exciting new feature in iOS 5 that will save you a lot of time building user interfaces for your apps. With a storyboard you have a better conceptual overview of all the screens in your app and the connections between them.
Citation preview
IOS Story boards
Presented byMuhammad Nabeel Arif
What is StoryboardStoryboarding is an exciting new
feature in iOS 5 that will save you a lot of time building user interfaces for your apps.
Advantages Of StoryboardsWith a storyboard you have a better
conceptual overview of all the screens in your app and the connections between them.
The storyboard describes the transitions between the various screens.
Storyboards make working with table views a lot easier with the new prototype cells and static cells features.
Can also use .xibs if needed with storyboards.
Disadvantages of Storyboards
You also need a big monitor, especially when you write iPad apps!
it is only available in iOS 5 onward
Like IB, not very friendly with other display engines and toolkits
Merges can be very difficult if not impossible if there are conflicts.
Creating Storyboard ProjectFire up Xcode and create a new project.Product Name: RatingsCompany Identifier: the identifier that you
use for your apps, in reverse domain notation
Class Prefix: leave this emptyDevice Family: iPhoneUse Storyboard: check thisUse Automatic Reference Counting: check
thisInclude Unit Tests: this should be unchecked
Creating Storyboard Project
In info.plist file, storyboard apps use the key UIMainStoryboardFile, or “Main storyboard file base name”, to specify the name of the storyboard that must be loaded when the app starts.
Incorporate Storyboard in Existing app
Open Existing Project, File > New > File > User Interface >Storyboard
UIStoryboard *storybrd = [UIStoryboard storyboardWithName:@"LTDStoryboardIPhone" bundle:nil];
AllProspectsNavigationController *navpd = [storybrd instantiateViewControllerWithIdentifier:@"AllProspectsNavigationController"];
navpd.tabBarItem.title = @"Prospects";
Storyboard SeguesA segue is a transition from one view
to another.E.g Select the + button and ctrl-drag
to the new Navigation Controller:
Life Cycle of a Segue The destination controller is created and initialized. The segue object is created and its
initWithIdentifier:source:destination: method is called. The identifier is the unique string you provided for the segue in Interface Builder, and the two other parameters represent the two controller objects in the transition.
The source view controller’s prepareForSegue:sender: method is called. See “Configuring the Destination Controller When a Segue is Triggered.”
The segue object’s perform method is called. This method performs a transition to bring the destination view controller on-screen.
The reference to the segue object is released, causing it to be deallocated.
Release the mouse button and a small popup menu shows up:
Manually initiating SegueIf you want to
perform a transition on some condition, you can fire a segue manually from code.
[self performSegueWithIdentifier: @"loadMyDetailView" sender:self];
Implementing a Custom SegueTo implement a custom segue, you subclass
UIStoryboardSegue and implement the two methods described earlier:◦ If you override the
initWithIdentifier:source:destination: method, call the superclass’s implementation, then initialize your subclass.
◦Your perform method must make whatever view controller calls are necessary to perform the transition you want. Typically, you use any of the standard ways to display a new view controller, but you can embellish this design with animations and other effects.
Unwinding Storyboard Segues Unwind segues can
allow transitioning to existing instances of scenes in a storyboard
You must have, higher up in the view controller hierarchy, a method that is:◦ Marked as IBAction◦ Takes one parameter
that is a UIStoryboardSegue*
Prototype cells
Prototype cells are one of the cool advantages that storyboards offer over regular nibs.
Prototype CellsThat looks a lot simpler! The only
thing you need to do to get a new cell is:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PlayerCell"];
Designing Our Own Prototype Cells
Using a standard cell style is OK for many apps, but I want to add an image on the right-hand side of the cell that shows the player’s rating (in stars). Having an image view in that spot is not supported by the standard cell styles, so we’ll have to make a custom design.
Designing Our Own Prototype Cells
Static Cells
Static table views are ideal in situations where a pre-determined number of items need to be displayed to the user. The fact that static table views do not need a data source makes them fast and easy to implement.
Passing DataSegues are fired automatically on
click of buttons etc. But you can pass data to destination ViewControllers
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { ◦ if ([[segue identifier]
isEqualToString:@"ShowNewVC"]) { NextViewController *nextVC = (NextViewController *)[segue
destinationViewController]; nextVC.someProperty = self.myProperty;
◦ }}
http://bit.ly/oI2GGWhttp://bit.ly/qIiGMbhttp://bit.ly/101z7JPhttp://bit.ly/SSiz8hhttp://bit.ly/11L9gFI