我在更新視圖中的細節時遇到小問題。如何在成功更新後重新加載視圖以更改詳細信息。更新細節後需要重新加載視圖目標C
以下是我的代碼。請幫我找出解決方案。提前致謝。
- (void)viewDidLoad
{
[super viewDidLoad];
}
-(void)viewWillAppear:(BOOL)animated
{
[self viewDidLoad];
[super viewWillAppear:animated];
[self.view setNeedsDisplay];
appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
profilearray=[[NSMutableArray alloc]initWithObjects:@"First Name:",@"Last Name:",@"Date of Birth:",@"Email:",@"Gender:",@"Address:",@"Country:",@"State:",@"City:",@"ZipCode:",@"Phone:",@"Guardian/Caretaker Details:",@"Name:",@"Relationship:",@"Email:",@"Doctor Details:",@"Name:",@"Phone:",@"Email:",@"Insurance Details:",@"Name:",@"Email:",nil];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [profilearray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [profilearray objectAtIndex:indexPath.row];
if(indexPath.row==0)
{
cell.detailTextLabel.text=[[NSUserDefaults standardUserDefaults] stringForKey:@"FirstName"];
}
if(indexPath.row==1)
{
cell.detailTextLabel.text=[[NSUserDefaults standardUserDefaults] stringForKey:@"LastName"];
}
if(indexPath.row==2)
{
cell.detailTextLabel.text=[[NSUserDefaults standardUserDefaults] stringForKey:@"DOB"];
}
if(indexPath.row==3)
{
cell.detailTextLabel.text=[[NSUserDefaults standardUserDefaults] stringForKey:@"Email"];
}
if(indexPath.row==4)
{
cell.detailTextLabel.text=[[NSUserDefaults standardUserDefaults] stringForKey:@"Gender"];
}
if(indexPath.row==5)
{
cell.detailTextLabel.text=[[NSUserDefaults standardUserDefaults] stringForKey:@"Address"];
}
return cell;
}
的tableview細胞後要重新加載您的看法請確認 –
是的,在我的編輯個人資料時更新按鈕被點擊並重定向到UIView的,有認爲應被重新加載並且細節應該被更新 – Rajeev