Quote:
Originally Posted by parm1024
What you want to do is create a subclass of UIView and start your drawing code in the drawRect method of the implementation file. If you look at your documentation on Xcode there are tutorials for Core Graphics. Make sure you have the view in Interface Builder with its class set to your subclass.
|
Hi parm1024, i tried to draw a line on a button( 400 by 400).
My attempt is:
UIButton *myButton=[UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton.frame=CGRectMake(200, 200, 400, 400);
myButton.backgroundColor=[UIColor redColor] ;
[self addSubview:myButton];
myView *view=[[myView alloc] initWithFrame:CGRectMake(10,10, 300, 300)];
[myButton addSubview:view];
Inside "myView" subclass i drew lines using CGContextRef class. But the problem is button losing its functionality over (10,10, 300, 300) region. There is no Interface Builder in my project. I request you to look into the problem in my project.
Thanks,
San