This is the very simple example. In this example we will see how to Hello iPhone display using navigation base application.
Step 1: Create a Navigation Base application using template. Give the application name “HelloWorld_NavigationBase”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.
Step 3: Xpand classes and notice Interface Builder created the RootViewController class for you (See the figure below). Expand Resources and notice the template generated a separate nib,RootViewController.xib, for the “HelloWorld_NavigationBase”.
Step 4: Open the RootViewController.m file, for this example we need to add only two lines of code in this file . So make the changes.
[super viewDidLoad];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell. // added below two line
[[cell textLabel] setTextAlignment:UITextAlignmentCenter];
[cell.textLabel setText:@"Hello iPhone!"];
return cell;
}
Step 5: Now compile and run the application in the Simulator.
You can Download SourceCode from here HelloWorld_NavigationBase
You certainly have some agreeable opinions and views. Your blog provides a fresh look at the subject.