-1
我有一個應用程序(的XCode 4.6,故事板的iOS 6.2和ARC)與幾個UIViews設置的UIView背景色:無法從控制器
的UIViews的每個XCode中已經定義了背景顏色。我希望能夠根據用戶選擇的方案更改背景顏色(當前爲lightYellow)。在CalendarViewController的-viewDidLoad方法,我有這樣的代碼:
self.leftGrid.backgroundColor = [UIColor blueColor];
[self.leftGrid setNeedsDisplay];
這是CalendarViewController的.h文件中的代碼:
// these all all UIViews
@class SubViewGrid;
@class SubViewData;
@class CalendarView;
@class TopGrid;
@class LeftGrid;
@interface CalendarViewController : UIViewController <UIScrollViewDelegate> {
}
// UIScrollView properties
@property (nonatomic, weak) IBOutlet UIScrollView *schedScrollView;
@property (strong, nonatomic) IBOutlet UIView *topGrid;
@property (strong, nonatomic) IBOutlet UIView *leftGrid;
@property (strong, nonatomic) IBOutlet UIScrollView *topGridSV;
@property (strong, nonatomic) IBOutlet UIScrollView *leftGridSV;
的問題是:什麼也沒有發生!我究竟做錯了什麼? (我看了SO和谷歌搜索,但沒有發現任何相關信息)
LeftGrid標記爲IBOutlet,並且連接到IB中的班級? – BergP
視圖加載時是否發生? F.e in viewDidLoad:?不在初始化方法 – BergP
我編輯了這個問題......我添加了@class行來刪除我剛剛得到的錯誤,但不知道他們除了防止循環引用之外還做了什麼... – SpokaneDude