내 스토리 보드에 viewcontroller를 설정하고이 뷰 컨트롤러 내에 tableView를 삽입했습니다. [self.tableView reloadData]하고 싶습니다.특정 테이블을 식별 한 다음로드/다시로드
내 viewController.m의 모습입니다. 내 tableView는 sharedView라는 IBOutlet이므로 메서드의 이름이지만 configureView를 호출 할 때 viewDidLoad와 같은 잘못된 작업을하고 있습니다. 그 다음에는 [self.sharedView reloadData];
데이터가 테이블 내부에 표시되지 않습니다.
#import "DetailViewController.h"
#import "sharedUsersTable.h"
@interface DetailViewController()
- (void)configureView;
@end
@implementation DetailViewController
#pragma mark - Managing the detail item
- (void)setDetailItem:(id)newDetailItem
{
if (_detailItem != newDetailItem) {
_detailItem = newDetailItem;
// Update the view.
[self configureView];
}
}
- (void)configureView
{
// Update the user interface for the detail item.
if (self.detailItem) {
self.detailDescriptionLabel.text = [[self.detailItem objectForKey:@"lock_name"] description];
activeUsers = [self.detailItem objectForKey:@"active_shared_users"];
[self.sharedView reloadData];
//NSLog(@"Info: %@", activeUsers);
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self configureView];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSString *)sharedView:(UITableView *)sharedView titleForHeaderInSection:(NSInteger)section {
return @"Shared with";
}
- (NSInteger)sharedView:(UITableView *)sharedView numberOfRowsInSection:(NSInteger)section
{
return activeUsers.count;
}
- (sharedUsersTable *)sharedView:(UITableView *)sharedView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"sharedUser";
sharedUsersTable *cell = [sharedView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[sharedUsersTable alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSDictionary *key;
NSString *name;
NSString *email;
// NSString *permission;
key = [activeUsers objectAtIndex:indexPath.row];
name = [key objectForKey:@"shared_user_name"];
email = [key objectForKey:@"email"];
NSLog(@"Info: %@", name);
cell.textLabel.text = [NSString stringWithFormat:@"%@", name];
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@", email];
return cell;
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the specified item to be editable.
return YES;
}
@end
논문 jQuery과 대신 "있는 tableView"의 "shareView"로 시작하는 대의원 방법으로 무엇입니까? – Larme
네, 그걸 섞어 놓은 것 같아요. 정확히 내가 뭘 잘못 했니? – Angad