버튼을 사용하여 UITableViewCell을 추가하는 방법 내 앱에 메모장 스타일을 추가하는 방법을 시도하고 있습니다. 내가 원했던 것은 오른쪽 상단의 "추가"버튼을 클릭 한 다음 메모를 작성할 수있는 새로운 메모를 만든 다음 완료를 클릭하면 메모를 메모에 추가하는 기존 메모장과 똑같이 작동합니다. UITableView의 셀입니다.IB
난 이미 jQuery과 모든 것이 그냥
이 작업을 실행하는 방법을 알 필요가 설정 한 - (IBAction를) noteAdd : 당신이 것을 클릭하면 (ID) 보낸 사람 { }
그리고 버튼은 내가 위에서 설명한 것을 수행합니다.
어떻게 이렇게 가겠어요? 나는 조금 길다.
이것은 내가 어떻게 TableView를 장면에 추가하는지입니다. 나는 '
: 나는 그것을 코드에 대한 몇 가지 의견을 해요 동안 UITableView
- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
에서
//tableview datasource delegate methods
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return cameraArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if(cell == nil){
cell = [[CustomCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
NSEnumerator *enumerator = [cameraArray objectEnumerator];
id anObject;
NSString *cellName = nil;
while (anObject = [enumerator nextObject]) {
cellName = anObject;
}
//static NSString *cellName = [cameraArray.objectAtIndex];
cell.textLabel.text = [NSString stringWithFormat:cellName];
return cell;
}
최고, 감사합니다! – tyler53