Get to the point – iPhone Development: Embed a Navigation controller to a Tab Bar Application
Get to the point – iPhone Development: Embed a Navigation controller to a Tab Bar Application
This tutorial is a continuation of the previous Tab Bar Application tutorial.
1- Open the tabbartest Xcode project. Create a new UIViewController subclass (File->New File) and name it TabBarNavigationController (see Figure 1). Make sure the “With XIB for user interface” option is marked. Three new files will be added to your Xcode project: TabBarNavigationController.h, TabBarNavigationController.m and TabBarNavigationController.xib.
2- Open the TabBarNavigationController.h file and replace the text UIViewController with UINavigationController.
3- We need to add a view controller to display contents. Create a new UIViewController subclass named NavigationContentsViewController (File->New File->UIViewController subclass).
4- Create a new view to add to the newly created UIViewController (File->New file->View XIB). This is not a Cocoa Touch Class file, be sure to select User Interface. Name the view FirstNavigationView. Open the file FirstNavigationView.xib and select File’s Owner. In the Identity tab of the Inspector, change the class to NavigationContentsViewController. Go to the “View Connection” tab, click on the view outlet, then drag & release it on the view canvas.
5- Open the MainWindow.xib file and add a new Tab Bar Item. Be sure the new Tab Bar Item is selected. Open the Inspector window (Tools->Inspector if it’s not already opened). On the Identity tab change the selected Class to TabBarNavigationController (see Figure 2).
6- Select the Tab Bar Controller (see Figure 3). Select the attributes tab from the Inspector Window. Select the second item in the View Controllers list. Choose the Navigation Controller class (see Figure 4).
7- Expand the “Tab Bar Controller” and expand the “Selected Navigation Controller (Item)”. Select the “View Controller (Item)” and change the class to NavigationContentsViewController (see Figure 5). You’ll see the name has changed to “Navigation Contents View Controller (Item)”. Click on the Attributes tab and set the NIB Name to FirstNavigationView in the Inspector window.
8- Save all files, click on the “Build and Run” button from Xcode, your app will be executed (see Figure 6).
No comments yet.
77Get to the point: Detect Internet Connection
about 6 months ago - No comments
We will be using Apple’s reachability class to detect the state of the Internet connection. Reachability is freely available from Apple’s website: http://developer.apple.com/iphone/library/samplecode/Reachability/
1- Create a View-based Application and name it InternetConnectionState
2- Download Apple’s Reachability App source code and copy reachability.h & reachability.m files to your application’s Classes folder.
3- Add these files to your XCode project. [...]
Get to the point – Code Snippets: Dialing a number, sending SMS & Email from within your app
about 7 months ago - No comments
These code snippets will allow you to dial a number, send an SMS & send an e-mail from within your application. They will all open up the selected application and close yours.
Dialing a number
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://123456"]];
Sending an SMS
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:123456"]];
Sending an E-mail
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto:amasso@amasso.info?subject=Hello&body=Testing your code snippet."]];
Get to the point: Tab Bar Application – Adding an UITableView to a Navigation Controller
about 7 months ago - 3 comments
Get to the point: Tab Bar Application – Adding an UITableView to a Navigation Controller
1- Open the previous tutorial sources (Tab Bar Application – Navigation Controller Embedded).
2- Edit the NavigationContentsViewController.h file. Change the source code so it looks like this:
#import <UIKit/UIKit.h>
@interface NavigationContentsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
NSMutableArray *itemsList;
UITableView *myTableView;
}
@property(nonatomic,retain)NSMutableArray *itemsList;
@property(nonatomic,retain)UITableView *myTableView;
@end
Notice the <UITableViewDelegate, UITableViewDataSource> protocols [...]
Get to the point – Code Snippets: NSString to NSInteger & vice versa
about 7 months ago - No comments
NSString to NSInteger code snippet:
NSString *strTest = [NSString stringWithFormat:@"%d", 10];
NSInteger to NSString code snippet:
NSInteger iTest = [strTest integerValue];
Get to the point – iPhone Development: Tab Bar Application
about 7 months ago - 2 comments
Get to the point, iPhone development tutorials for those programmers who want concise step by step tutorials, but do not have the time to watch a 30 min video tutorial.
Get to the point – iPhone Development: Tab Bar Application (Adding new views)
1- Open Xcode and create a new “Tab Bar Application” (see Figure 1). Name [...]





