1
사용자 정의 UITableViewCell
이 UITableView
에 삽입 된 UITableView
이 있습니다.사용자 지정 UITableViewCell 내의 UiTableView
맞춤 UITableViewCell
의 클래스가있다 :
@interface XYZcustomtakeawayTableViewCell: UITableViewCell <UITableViewDataSource,UITableViewDelegate>
{
NSString * order;
}
@property (strong, nonatomic) IBOutlet UITableView * tableviewinside;
@property (nonatomic, retain) NSString * order;
@end
#import "XYZcustomtakeawayTableViewCell.h"
@implementation {XYZcustomtakeawayTableViewCell
{
NSMutableArray * dataArray;
}
@synthesize tableviewinside, order;
- (id) initWithStyle: (UITableViewCellStyle) style reuseIdentifier: (NSString *) reuseIdentifier: (NSString *) Order
{
self = [super initWithStyle: style reuseIdentifier: reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void) awakeFromNib
{
// Initialization code
dataArray = [[order componentsSeparatedByString: @ ""] mutableCopy];
self.tableviewinside.delegate = self;
self.tableviewinside.dataSource = self;
}
- (void) setSelected: (BOOL) selected animated: (BOOL) animated
{
[super setSelected: selected animated: animated];
// Configure the view for the selected were
}
- (NSInteger) numberOfSectionsInTableView: (UITableView *) tableView
{
return 1;
}
- (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section
{
dataArray = [[order componentsSeparatedByString: @ ""] mutableCopy];
dataArray.count return;
}
- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath
{
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: @ "cell"];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: @ "cell"];
}
cell.textLabel.text = [dataArray objectAtIndex: indexPath.row];
return cell;
}
@end
클래스있는 UITableViewController
import <UIKit/UIKit.h>
@interface XYZGestisciTakeAwayTableViewController: UITableViewController
@end
는 NSString * ordine_1 = @ "1 리타 2 나폴";
- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath
{
static NSString * simpleTableIdentifier = @ "cell";
XYZcustomtakeawayTableViewCell * cell = (XYZcustomtakeawayTableViewCell *) [tableView dequeueReusableCellWithIdentifier: simpleTableIdentifier];
if (cell == nil)
{
NSArray * nib = [[NSBundle mainBundle] loadNibNamed: @ "custom_prenotazioni" owner: self options: nil];
cell = [nib objectAtIndex:0];
}
cell.ordine = ordine_1; //FAILURE !!!!!!!!!!!!
return cell;
}
응용 프로그램 실행이 중지되는 이유는 무엇입니까? cell.ordine = ordine_1;
을 삭제하면 작동합니다.
사용자 정의 셀에서 'ordine'을 어디에 선언합니까? 나는'order'와'tableviewinside'를위한 프라퍼티만을 볼 수 있습니다. – Stonz2
충돌이 일어나거나 멈 춥니 다? 또한 @ Stonz2는 – random