저는 테이블 뷰 컨트롤러가 아닌 일반 뷰 컨트롤러가 있고 뷰에는 테이블 뷰가 있습니다. 내 테이블 뷰 셀은 사용자 정의이며 방금 스토리 보드를 통해 만들었지 만 코드에서 아무 것도하지 않았지만 응용 프로그램을 실행할 때 tableview는 비어 있습니다. tho가 나에게 일어나고있는 이유에 관한 어떤 생각? 여기에 다른 것들을 보았습니다. 그러나이 모든 다른 시나리오는 NSArray를 사용하여 코드에서 tableview를 채우는 사람과 관련이 있습니다.하지만 광산은 관례이므로 나는 그렇게하지 않습니다. 어떤 도움을 주셔서 감사합니다. 그리고이 복제물을 표시하기 전에 실제로 이것을 읽어주십시오. 다음과 같이 내 코드는 다음과 같습니다사용자 정의 테이블보기 셀이 비어 있습니다.
@interface TTViewController()
{
NSArray *messageComponents;
}
@end
@implementation TTViewController
@synthesize dateTimePicker, messageSetupTableView;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.title = @"Message Setup";
messageComponents = [[NSArray alloc] initWithObjects:@"Recipient",@"Message", @"Date",@"haha", nil];
messageSetupTableView.backgroundColor = [UIColor groupTableViewBackgroundColor];
messageSetupTableView.alpha = 0.9;
}
#pragma mark -
#pragma mark Table view data source
-(NSInteger) numberOfSectionsInTableView:(UITableView *) tableView{
return [messageComponents count];
}
-(NSInteger)tableView:(UITableView *) tableVew numberOfRowsInSection:(NSInteger)section{
return 1;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
}
}
// Configure the cell.
cell.textLabel.text = [messageComponents objectAtIndex:indexPath.row];
cell.imageView.image = [UIImage imageNamed:[messageComponents objectAtIndex:indexPath.row]];
cell.backgroundColor = [UIColor redColor];
cell.textLabel.textColor = [UIColor whiteColor];
UIColor *selectedColor = [UIColor blueColor];
UIView *myBackgroundColor = [[UIView alloc] init];
[myBackgroundColor setBackgroundColor:selectedColor];
[cell setSelectedBackgroundView:myBackgroundColor];
return cell;
가 내 테이블 뷰가 다른의 date picker in one section
, 다른의 textview
및 a button and a few text fields
갖고 싶어. 감사합니다
지금까지 시도한 코드를 붙여 넣으세요. – Pawan
방금 내 질문에 몇 가지 코드를 게시했습니다. –
[quickdialog] (https://www.cocoacontrols.com/controls/quickdialog), 언급 한 것과 같은 요구 사항에 대한 아주 좋은 예입니다. – cjd