USE CASE-1
|
Main
|
UITableView Controller
|
UITableView
|
UITableViewCell
|
UIComponents
=============
1) Create Single View Application
2) Go to Main.StoryBoard, delete existing viewcontroller scene and delete referencing class also
3) Add a tableviewcontroller scene in main.storyboard and add referencing class also in navigator, which is going to be subclass of UITableViewController
4) Click on TableViewController scene, go to property inspector choose checkmark use "initialviewcontroller" (This is configuration of storyboard entry point)
5) go to tableviewcontroller.m implement datasource methods
6) go to CellforRowAtIndexPath method and provide identifier value as string "MyCell"
7) Go to StoryBoard Select Your Cell, Open Inspector and provide identifier name
8) Build and run Application
|
Main
|
UITableView Controller
|
UITableView
|
UITableViewCell
|
UIComponents
=============
1) Create Single View Application
2) Go to Main.StoryBoard, delete existing viewcontroller scene and delete referencing class also
3) Add a tableviewcontroller scene in main.storyboard and add referencing class also in navigator, which is going to be subclass of UITableViewController
4) Click on TableViewController scene, go to property inspector choose checkmark use "initialviewcontroller" (This is configuration of storyboard entry point)
5) go to tableviewcontroller.m implement datasource methods
idevices=[NSArray arrayWithObjects:@"iPhone",@"iPad",@"iPod",@"iPadmini", nil];
androidDevices=[NSArray arrayWithObjects:@"HTC",@"Samsung",@"Nexus",@"Lenovo", nil];
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//return 5;
if (section==0) {
return idevices.count;
}
else
{
return androidDevices.count;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell" forIndexPath:indexPath];
// Configure the cell...
// cell.textLabel.text=@"Hello iOS SDK";
if (indexPath.section==0) {
cell.textLabel.text=[idevices objectAtIndex:indexPath.row];
}
else
{
cell.textLabel.text=[androidDevices objectAtIndex:indexPath.row];
}
return cell;
}
6) go to CellforRowAtIndexPath method and provide identifier value as string "MyCell"
7) Go to StoryBoard Select Your Cell, Open Inspector and provide identifier name
8) Build and run Application







No comments:
Post a Comment