9:51 AM

UIView !!

Posted by pradeep T

This blog contains details about UIView !!


- (void)applicationDidFinishLaunching: (UIApplication *)application {

UIButton *myButton= [[UIButton alloc] init];
myButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
myButton.frame = CGRectMake(105,180, 115, 35);
[myButton setTitle:@"Apply Image" forState:UIControlStateNormal];
myButton.backgroundColor = [UIColor clearColor];
[myButton addTarget:self action:@selector(ApplyImage: ) forControlEvents:UIControlEventTouchUpInside];

[window addSubview:myButton];//So Here we keeping a button on windowthe button action is ApplyImage() methos calling
[window makeKeyAndVisible];
[myButton release];
}

-(void)ApplyImage:(id)sender
{
UIView *mview= [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];

UIImageView *img=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"fantasy_13.jpg"]];
img.frame=CGRectMake(0, 0, img.frame.size.width, img.frame.size.height);
[mview addSubview:img];
[img release];

UILabel *name = [[UILabel alloc]initWithFrame:CGRectMake(105,180,250,25)];
name.text = @"This is my View Example";
name.textColor=[UIColor whiteColor];
name.font=[UIFont boldSystemFontOfSize:13];
name.backgroundColor=[UIColor clearColor];
[mview addSubview:name];
[name release];

[window addSubview:mview];
[mview release];
}

0 comments: