When customizing an UITableView, how can I know wether the cell is the first, last or only one in the section in the
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath`
method?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To find out if it is the last row in a section, call
tableView:numberOfRowsInSection:on the data source delegate (presumably, it’sself, since you are in atableView:cellForRowAtIndexPath:method). If the value returned from that method equalsindexPath.row+1, you are at the last row. If additionallyindexPath.row == 0, you are at the only row. IfindexPath.row == 0buttableView:numberOfRowsInSection:returned a number other than 1, you are looking at the first row in a section.