Why Label Outlets cannot be connected to UITableViewCell Class
ios, ios8, iphone, objective-c, uitableview
Solution
- Create a xib file. Delete UIView and drag UITableviewcell.
- Set your UITableviewcell class and a identifier for the cell
- Drag the components on the cell and connect them with your class.
On the method `(void)viewDidLoad` of your UITableViewController, set:
[self.tableView registerNib:[UINib nibWithNibName:nameOfXibFile bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:identifierOfCell];
On the method `(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath`, set:
YourClassTableViewCell *cell = [tableView dequeueReusableCellWithReuseIdentifier:identifierOfCell forIndexPath:indexPath];
and set the values for the labels `cell.label.text = @"Your text".`
Good luck!
Problem
I create a table view cell subclass and set it as the class of the prototype.I want to add the outlets to that class and connect them. But xcode do not respond. And i try to add the outlets of button in the next time,it works. I want to display a picture,it is pity that i don't have enough reputations. I don't understand why this happen.Can somebody help me,Plesae!!