【发布时间】:2016-01-07 06:44:04
【问题描述】:
这是我的 viewcontroller.m
@interface ViewController ()
{
NSArray *sectionTitleArray;
}
@property (strong, nonatomic) IBOutlet UITableView * tablevw;
- (void)viewDidLoad
{
[super viewDidLoad];
_tablevw.delegate = self;
_tablevw.dataSource = self;
sectionTitleArray = @[ @{@"text": @"About Step0ne"},
@{@"text": @"Profile"},
@{@"text": @"Matches"},
@{@"text": @"Messages"},
@{@"text": @"Photos"},
@{@"text": @"Settings"},
@{@"text": @"Privacy"},
@{@"text": @"Reporting issues"},
];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return sectionTitleArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
-(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];
}
cell.textLabel.text = [[sectionTitleArray objectAtIndex:indexPath.row]objectForKey:@"text"];
return cell;
}
我是 Xcode 的新手,我在每个 tableview 单元格第一个对象中获得输出,即关于 Step0ne 正在显示,我需要所有对象都应显示在 UITableView 单元格中。任何帮助都是可观的。
【问题讨论】:
标签: ios objective-c uitableview nsarray nsdictionary