Objective c 如何在OSX应用程序的NSTableview中显示数组值
我的viewController.xib有一个按钮和tableview,我有一些数组值。如果我单击button,数组数据将显示在tableview中。Objective c 如何在OSX应用程序的NSTableview中显示数组值,objective-c,cocoa,nstableview,Objective C,Cocoa,Nstableview,我的viewController.xib有一个按钮和tableview,我有一些数组值。如果我单击button,数组数据将显示在tableview中。 是否可以不使用ApplicationIDFinishLaunching方法。谢谢。我在问OSX应用程序的这个问题。您可以按照本教程进行操作:如何连接或将NSTableView控制器连接到myviewController.xib的设置。请回复我按照本教程获取帮助 - (NSInteger)numberOfSectionsInTableView:(U
是否可以不使用ApplicationIDFinishLaunching方法。谢谢。我在问OSX应用程序的这个问题。您可以按照本教程进行操作:如何连接或将NSTableView控制器连接到myviewController.xib的设置。请回复我按照本教程获取帮助
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return exampleArray.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [exampleTableView dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CellWithSwitch"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.font = [UIFont systemFontOfSize:14];
}
cell.textLabel.text = [exampleArray objectAtIndex:indexPath.row];
}
-(IBAction)exampleButtonAction:(id)sender
{
exampleArray=[[NSMutableArray alloc]initWithObjects:@"example1",@"example2",@"example3",@"example4",nil];
[exampleTableView reloadData];
}