0

大家好...在我的应用程序中,我包含了一个包含当前 PFUser 的所有数据的视图。一切都是在没有故事板的情况下直接从 ios7 上的代码完成的……显示没有问题,但是当我执行注销然后使用不同于前一个用户的另一个用户再次登录时,我没有更新信息。该视图继续将该用户的数据保留给我后来一起来的那个人。

我的错在哪里?

感谢所有的罗里

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self FFCustomViewGraph];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];


}
-(void)viewDidAppear:(BOOL)animated {
    self.navigationController.navigationBarHidden=NO;
}



-(void)FFCustomViewGraph {

    if ([PFUser currentUser] != nil) {
        PFQuery *query = [PFUser query];
        [query whereKey:@"Nome_Cognome" equalTo:[PFUser currentUser]];
        [query getFirstObjectInBackgroundWithBlock:^(PFObject *object, NSError *error) {


            UIView *FFProfileView = [[UIView alloc] initWithFrame:CGRectMake(4, 68, 312, 123)];
            [FFProfileView setBackgroundColor:[UIColor colorWithRed:(237/255.0) green:(237/255.0)  blue:(237/255.0)  alpha:(1)]];
            [FFProfileView.layer setMasksToBounds:YES];
            [FFProfileView.layer setCornerRadius:3];
            [self.view addSubview:FFProfileView];



            PFImageView *FFImageProfile = [[PFImageView alloc] initWithFrame:CGRectMake(104, 136, 105, 105)];
            FFImageProfile.image = [UIImage imageNamed:@"FFIMG_Camera"];
            FFImageProfile.file = (PFFile *)[[PFUser currentUser] objectForKey:@"foto"]; // remote image
            [FFImageProfile.layer setMasksToBounds:YES];
            [FFImageProfile.layer setCornerRadius:52.0f];
            [FFImageProfile loadInBackground];
            [self.view addSubview:FFImageProfile];


            UILabel *FFNomeUsername = [[UILabel alloc] initWithFrame:CGRectMake(4, 59, 312, 70)];
            [FFNomeUsername setFont:[UIFont systemFontOfSize:18]];
            [FFNomeUsername setTextAlignment:NSTextAlignmentCenter];
            [FFNomeUsername setText:@"Massimiliano De Pascale"];
            [FFNomeUsername setTextColor:[UIColor colorWithRed:(158/255.0) green:(158/255.0) blue:(158/255.0) alpha:(1)]];
            FFNomeUsername.text = [[PFUser currentUser] objectForKey:@"Nome_Cognome"];
            [self.view addSubview:FFNomeUsername];

        }];
    } else {

    }








}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)FFLogout:(id)sender {
[PFUser logOut];
[self performSegueWithIdentifier:@"Login" sender:self];

}
@end
4

1 回答 1

0

我想我已经解决了!...问题是:

[self FFCustomViewGraph] 被插入到 viewDidLoad ...

我通过在 viewDidLoad 中移动它来解决它

 - (void) viewDidAppear: (BOOL) animated

现在,只要我与另一个用户登录,就会检索数据......

你认为这是对的还是只是运气?

于 2013-09-27T20:23:03.600 回答