And*_*ang 2 iphone objective-c
我写了一个特殊的UITableViewCell.现在我需要从文本字段中获取文本
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
CustomCell *custumCell = [tableView cellForRowAtIndexPath:indexPath];
//warning: incompatible Objective-C types initializing 'struct UITableViewCell *', expected 'struct CustomCell *'
NSString *title = [custumCell cellTitle].text;
[self setArticleReaded:title];
[title release];
Run Code Online (Sandbox Code Playgroud)
}
#import <UIKit/UIKit.h>
@interface CustomCell : UITableViewCell {
IBOutlet UILabel *cellTitle;
IBOutlet UILabel *cellSubTitle;
IBOutlet UILabel *cellPubDate;
}
@property (nonatomic, retain) IBOutlet UILabel *cellTitle;
@property (nonatomic, retain) IBOutlet UILabel *cellSubTitle;
@property (nonatomic, retain) IBOutlet UILabel *cellPubDate;
@end
Run Code Online (Sandbox Code Playgroud)
我希望有人知道解决方法.
施展它:
CustomCell *custumCell = (CustomCell *)[tableView cellForRowAtIndexPath:indexPath];
Run Code Online (Sandbox Code Playgroud)
这应该可以让您访问单元格的属性.
| 归档时间: |
|
| 查看次数: |
2027 次 |
| 最近记录: |