大佬教程收集整理的这篇文章主要介绍了ios – 在XCODE中使用我自己的Cell对象,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
但是,如何在didSELEctRowATindexPath中解构我所做的事情?
我目前收到错误“不兼容的指针类型初始化’MyCell * __ strong’,表达式为’UITableViewCell’”
鉴于我的对象(MyCell)基于UITableViewCell,我不明白为什么我会收到此错误.
你能帮我理解我做错了吗?
我的另一种选择是对单元格中的两个标签中的每个标签使用“TAG”并以这种方式获得它们,但我只是在这里试验,试图了解更多关于这一切是如何工作的.
任何帮助将不胜感激.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowATindexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"myCellID"; MyCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; if (cell == nil) { cell = [[MyCell alloc] initWithStyle:UITableViewCellStyleDefault reusEIDentifier:CellIdentifier]; } cell.accountCode.text = @"0009810"; cell.accountName.text = @"Agent Name"; return cell; }
这是另一种方法.我在MyCell上遇到错误* cell = [tableView cellForRowATindexPath:indexPath];
- (void)tableView:(UITableView *)tableView didSELEctRowATindexPath:(NSIndexPath *)indexPath { // Get the cell that was SELEcted MyCell *cell = [tableView cellForRowATindexPath:indexPath]; AccountRecord *accountRecord = [[AccountRecord alloc] init]; accountRecord.accountCode = cell.accountCode.text; accountRecord.accountName = cell.accountName.text; [self performSegueWithIdentifier:@"AccountDetail" sender:accountRecord]; }
这是MyCell
#import <UIKit/UIKit.h> @interface MyCell : UITableViewCell @property (nonatomic,strong) IBOutlet UILabel *accountCode; @property (nonatomic,strong) IBOutlet UILabel *accountName; @end
任何帮助,将不胜感激.
以上是大佬教程为你收集整理的ios – 在XCODE中使用我自己的Cell对象全部内容,希望文章能够帮你解决ios – 在XCODE中使用我自己的Cell对象所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。