Pergunta

I have an app (XCode 4.6, Storyboards, iOS 6.2 and ARC) with several UIViews:

enter image description here

Each of the UIViews has the background color defined in XCode. I want to be able to change the background color (currently lightYellow) based on user selected schemes. In the CalendarViewController's -viewDidLoad method, I have this code:

self.leftGrid.backgroundColor = [UIColor blueColor];
[self.leftGrid setNeedsDisplay];

This is the code in the CalendarViewController's .h file:

//  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;

The problem is: nothing happens! What am I doing wrong? (I have looked at SO and Googled, but found nothing pertinent)

Foi útil?

Solução

It seems like self.leftGrid == nil in viewDidLoad. Maybe owner of xib setted incorrect. Or connection between view in IB and it's owner field.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top