저는 Mac 개발 응용 프로그램에 매우 익숙합니다. 그래서 그냥 실용적인 운동을하고.plist 파일이있는 NSTableView
내 plist 파일의 데이터를 표시하는 tableview를 만들고 싶습니다.
하나의 windowcontroller 클래스와 window controller.xib 파일이 있습니다.
NSTableView를 .xib 파일로 끌어다 놓습니다.
지금은 내있는 tableview 행을 표시하기 위해 무엇을해야 PLIST 파일
- (void)windowDidLoad
{
[super windowDidLoad];
NSBundle *bundle = [NSBundle mainBundle];
NSString *path = [bundle pathForResource:@"tenth" ofType:@"plist"];
file = [[NSArray alloc] initWithContentsOfFile:path];
}
를로드하는 데이 코드를 사용?
어떤 방법을 사용해야합니까? 그리고 어떻게??
NSArrayController
또는
implement the NSTableViewDataSource
protocol와 하나
bindings을 사용할 수 있습니다
- (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] autorelease];
}
NSArray *temp = [file objectAtIndex:indexPath.row];
cell.textLabel.text = [temp objectAtIndex:0];
return cell;
}
NSTableView를 사용하여 속성 목록을 나타내려고한다고 생각하지 않습니다. OS X의 나무는 일반적으로 NSOutlineView로 표현됩니다. 속성 목록 파일은 평면 구조가 아니므로 문제가 발생할 것입니다. –