背景:我有三種觀點。一個介紹性視圖,一個上傳視圖和主視圖。作爲類(與他們各自的頭)我有rootViewController(SwitchViewController),IntroViewController和UploadViewController。第一個要顯示的視圖是IntroView。用戶按下一個按鈕(在SwitchViewController中聲明),將它們帶到UploadView,然後在UploadView中選擇一個圖像,然後再次按下按鈕返回到IntroView。Objective-C新手。從另一個控制器更改控制器的屬性?
問題是,當用戶使用UIImagePickerController選擇圖像時,切換視圖的按鈕不會隱藏,也不會在視圖(屏幕)頂部帶有徽標的UIImageView。 UIImageView和UIButton都在SwitchViewController的頭文件中聲明。
使用的代碼:
UploadViewController.h
#import [...] //Imports
@class SwitchViewController;
@interface UploadViewController :
UIViewController <UIImagePickerControllerDelegate,
UINavigationControllerDelegate,UIActionSheetDelegate> {
UITextField *imageTextField;
UIImageView *uploadedImage;
SwitchViewController *switchViewController;
[...]
}
@property (nonatomic, retain) SwitchViewController *switchViewController;
@property (nonatomic, retain) IBOutlet UITextField *imageTextField;
@property (nonatomic, retain) IBOutlet UIImageView *uploadedImage;
[...]
@end
UploadViewController.m
[...]
- (IBAction) selectImageButtonPressed {
self.switchViewController.submitButton.hidden = YES;
self.switchViewController.imageLogo.hidden = YES;
[...] //continues
我剛剛開始最近在編程Objective-C的,所以請原諒我,如果這個問題是很必要。我已經看過並正在關注APRESS的「開始iPhone 3開發」。但即使有助於大大理解基礎知識,有時我也會迷失方向。 PS:如果回答的問題更清晰,則可以提供SwitchViewController.h和.m代碼段代碼。但我認爲這段文字很大。
您已正確連接Interface Builder中的插座,對不對? – 2011-01-25 14:56:33
是的,我做過。我已經檢查了幾次,以確保... – Joze 2011-01-25 15:00:28