我有一个视图控制器alertForNeedsClassification作为另一个类中的属性,例如:
@interface SCAAppDelegate()
{
HomeScreenViewController * _homeScreenViewController;
NSInteger SCAStatus;
}
@property (strong, nonatomic) PromptClassifyViewController * alertForNeedsClassification;
@end
@implementation SCAAppDelegate
@synthesize alertForNeedsClassification;
@synthesize window = _window;
PromptClassifyViewController 的界面如下所示:
@interface PromptClassifyViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *headerTitle;
@property (weak, nonatomic) IBOutlet UITextView *message;
@property (weak, nonatomic) IBOutlet UIButton *notNowButton;
@property (weak, nonatomic) IBOutlet UIButton *classifyButton;
@property (weak, nonatomic) IBOutlet UIImageView *backgroundImageView;
@property (weak, nonatomic) IBOutlet UIView *alertView;
@property NSUInteger tag;
@property (weak, nonatomic) IBOutlet id<PromptClassifyViewControllerDelegate> delegate;
- (void)show;
- (void)showFromView:(UIView *)view;
- (IBAction)show:(id)sender;
- (IBAction)dismiss:(id)sender;
- (IBAction)buttonWasPressed:(id)sender;
- (void)setHeaderTitleWithText:(NSString *)text;
@end
我正在尝试更改 IBOutlets消息和headerTitle文本的值,如下所示:
alertForNeedsClassification = [[PromptClassifyViewController alloc] initWithNibName:@"PromptClassifyViewController" bundle:nil];
//[alertForNeedsClassification setDelegate:self];
self.alertForNeedsClassification.headerTitle.text = @"A title";
alertForNeedsClassification.message.text = @"A message";
然后我显示调用show方法的alertForNeedsClassification(它类似于自定义 uialertview,但它不是 uialertview 的子类)。
问题是,无论我如何更改它,alertForNeedsClassification.view 上的文本始终是笔尖中定义的文本,即。我无法以编程方式更改它。
我的自定义警报视图基于 Jeff LaMarche 的设计:http: //iphonedevelopment.blogspot.com/2010/05/custom-alert-views.html
任何想法可能会发生什么?