次のように、ビュー コントローラーの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
何が起こっているのでしょうか?