Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You'll need some custom UITableViewCell subclass. Something like that:</p> <p>.h file:</p> <pre><code>#define kBackButtonPressedNotification @"kBackButtonPressedNotification" #define kForwardButtonPressedNotification @"kForwardButtonPressedNotification" @interface ButtonsTableViewCell : UITableViewCell { @private UIButton* _backButton; UIButton* _forwardButton; } @end </code></pre> <p>.m file:</p> <pre><code>@implementation ButtonsTableViewCell -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if(self){ _backButton = [UIButton buttonWithType:UIButtonTypeCustom]; _backButton.frame = CGRectMake(10, 10, 100, 30); //put numbers that are good for you [_backButton setImage:[UIImage imageNamed:@"someBackButtonImage.png"] forState:UIControlStateNormal]; [_backButton addTarget:self action:@selector(backPressed) forControlEvents:UIControlEventTouchUpInside]; [self.contentView addSubview:_backButton]; _forwardButton = [UIButton buttonWithType:UIButtonTypeCustom]; _forwardButton.frame = CGRectMake(10, 10, 100, 30); //put numbers that are good for you [_forwardButton setImage:[UIImage imageNamed:@"someForwardButtonImage.png"] forState:UIControlStateNormal]; [_forwardButton addTarget:self action:@selector(forwardPressed) forControlEvents:UIControlEventTouchUpInside]; [self.contentView addSubview:_forwardButton]; } return self; } -(void)backPressed{ [[NSNotificationCenter defaultCenter]postNotificationName:kBackButtonPressedNotification object:nil]; } -(void)forwardPressed{ [[NSNotificationCenter defaultCenter]postNotificationName:kForwardButtonPressedNotification object:nil]; } @end </code></pre> <p>In your controller's <code>-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;</code> method return number of rows + 1 (for additional row with buttons). In the <code>-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;</code> check the indexPath.row and when it's the last one -> return instance of that custom cell. And of course you'll need to register for those notifications, let's say like this:</p> <pre><code>-(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(yourBackMethod) name:kBackButtonPressedNotification object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(yourForwardMethod) name:kForwardButtonPressedNotification object:nil]; } -(void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; [[NSNotificationCenter defaultCenter]removeObserver:self]; } </code></pre> <p>Don't forget to provide proper implementation for <code>yourBackMethod</code> and <code>yourForwardMethod</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload