3

我一直在我的新 iOS 应用程序开发中使用 Parse.com 服务,到目前为止它就像一个魅力,但是我一直在尝试使用 swift 和 Objective-C 中的代码修改 PFLogInViewController 中的登录按钮文本,但是结果相同(无!)

对象

 [logInViewController.logInView.logInButton setTitle:@"Test!" forState:UIControlStateNormal];
 logInViewController.logInView.logInButton.titleLabel.text = @"Another Test";

迅速

 self.logInView.logInButton.setBackgroundImage(UIImage(named: "loginBtn"), forState: UIControlState.Normal )
4

2 回答 2

2

我终于弄清楚如何解决这个问题,您必须在事件中应用更改

迅速

override func viewDidLayoutSubviews()
{
    println("didLaoutSubView")
    self.logInView.logInButton.setTitle("Test", forState: UIControlState.Normal)
    self.logInView.logInButton.setTitle("Test", forState: UIControlState.Highlighted)
}

对象

-(void)viewDidLayoutSubviews
{
    [self.logInView.logInButton setTitle:@"Test!" forState:UIControlStateNormal];
    self.logInView.logInButton.titleLabel.text = @"Another Test";
}
于 2014-07-10T18:33:39.210 回答
1

这对我不起作用,因为我呈现视图的方式。我是这样做的:

 PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
            
 [logInViewController setDelegate:self]; // Set ourselves as the delegate
            
[logInViewController.logInView.logInButton setTitle:@"Sign In" forState:UIControlStateNormal];

[self presentViewController:logInViewController animated:YES completion:NULL];

于 2017-05-31T18:08:15.210 回答