Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  2. {
  3. return 1;
  4. }
  5.  
  6. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  7. {
  8. return exampleArray.count;
  9. }
  10. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  11. {
  12. return 50;
  13. }
  14. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  15. {
  16. UITableViewCell *cell = [exampleTableView dequeueReusableCellWithIdentifier:@"cell"];
  17. if (cell == nil)
  18. {
  19. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CellWithSwitch"];
  20. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  21. cell.textLabel.font = [UIFont systemFontOfSize:14];
  22. }
  23. cell.textLabel.text = [exampleArray objectAtIndex:indexPath.row];
  24. }
  25.  
  26. -(IBAction)exampleButtonAction:(id)sender
  27. {
  28. exampleArray=[[NSMutableArray alloc]initWithObjects:@"example1",@"example2",@"example3",@"example4",nil];
  29. [exampleTableView reloadData];
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement