Tag: uitableview

UITableView with one visible cell: determine which is most visible

Given a UITableView with a single visible cell at any given time, how can I determine which cell is most in view while the table view is being scrolled? I know I can get an array of visible cells by doing this: NSArray *paths = [tableView indexPathsForVisibleRows]; And then get the last cell (or first, […]

Change background color of UITableViewCell when reordering in editing mode

I’m working on a application containing a UITableView. The only thing which needs to be possible for users, is to reorder the contents of the UITableView. When in editing mode the background color of the tableview cells turns transparent. Is there any way of keeping the original background color of the tableview cell when it’s […]

App crashes when Back button tapped while scrolling table view

I present a modal table view within a navigation view with a Back button. The back button sends a message to the modal view’s delegate to dismiss the modal view. If I scroll the table view and then tap the Back button on the navigation bar while the table view is still scrolling, the app […]

Get position of cell or text field in this cell

I have a split view controller: view & tableview. In this table view I have custom cells with text field. I don’t know how many cells will I have, so it generate automatically. And now I’m trying scroll to textfield, when it becomeFirstResponder. I’ve tried something like this: -(void) textFieldDidBeginEditing:(UITextField *)textField { CGPoint focusOnTextField = […]

Centering textLabel vertically in UITableViewHeaderFooterView from tableView: willDisplayHeaderView: forSection:

I am trying to vertically center the text label for a tableViewHeader. Here is the relevant code from – (void) tableView: (UITableView*) tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section: – (void) tableView: (UITableView*) tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section { if(![view isKindOfClass:[UITableViewHeaderFooterView class]]){ return; } UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView *) view; UILabel* label = tableViewHeaderFooterView.textLabel; label.textAlignment = NSTextAlignmentCenter; label.font = […]

How to get UITableView Label Text string – Custom Cell

I have a UITableView with CustomCell. The custom cells contain a UILabel and a UIImageView. I saw online that it is possible to get the text from a normal UITableView cell and store it in a string when the user presses the cell. But how can you do this when you are using a custom […]

How to go to the next cell (Detail View) in a UITableView?

So, i have a UITableView split in 3 sections. I want to be able, once i opened up the second row in the first section (i.e.), to swipe left to go to the next cell, and to swipe right to go the previous cell. I wrote the code for the swipe: SecondDetailView.m – (void)viewDidLoad { […]

Button inside a custom uitableviewcell not working

I have a custom TableCell and a UiButton is associated with this via IB. But the button action method always return the button index as zero Below is my code //Inside CellForRow [cell.M_CtrlBtnChat addTarget: self action: @selector(buttonPressed:withEvent:) forControlEvents: UIControlEventTouchUpInside]; – (void) buttonPressed: (id) sender withEvent: (UIEvent *) event { UITouch * touch = [[event allTouches] […]

reloadData not calling cellForRowAtIndexPath

My project uses a Split View Controller containing a table view with a list of class periods and a main view detailing the class periods. When the app first loads up, there are no entries in the table view and the main view shows a login screen. When the user logs in, the table view […]

UIPageViewController inside of a UITableViewCell

Hey I wanted to ask how do I implement a UIPageViewController inside of a UITableViewCell. I have been reading around, but so far nothing seems to work for anyone trying. I would appreciate some hints, no need for a full answer.. Thanks!.