im quite new to IOS; and i made some gradient etc via the drawRect method, now, if i want to implement it, i subclass it to the view. But i was thinking, is there any way i can call the method drawRect and make it set the background for the view, from a Subclass of the ViewController ?
Layout is like this:
BackgroundColor.h
#import <UIKit/UIKit.h>
@interface BackgroundColor : UIView
@end
BackgroundColor.m
#import "BackgroundColor"
@implementation BackgroundColor___Fuschia
- (void)drawRect:(CGRect)rect
{
...
}
@end
ViewControllerNav.h
#import <UIKit/UIKit.h>
@interface ViewControllerNav : UIViewController
@end
ViewControllerNav.m
@interface ViewControllerNav ()
@end
@implementation ViewControllerNav
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
I Assume i have to import BackgroundColor and init the method or ?
(PS: My drawRect method uses CGRect frame = rect; so i need the view size passed i asume ?)
Any help is apriciated