开发者

how to resize the button image in iphone

Merged with how to resize the button image in iphone.

im new in iphone.now im developing button images in iphone. here images are view like large size view. I want to resize the image.I implement code like this.

images = [[NSMutableArray alloc]init];
 [images addObject:[UIImage imageNamed:@"bearlarge.jpg"]];
 [images addObject:[UIImage imageNamed:@"bufflo_l开发者_如何学运维arge.jpg"]];
 [images addObject:[UIImage imageNamed:@"camel_large.jpg"]];
 UIView *view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

 int row = 0;
 int column = 0;


 for(int i = 0; i < images.count; ++i) {



 // UIImage *thumb = [images objectAtIndex:i];

  UIButton * button = [UIButton buttonWithType:UIButtonTypeRoundedRect];



   button.frame = CGRectMake(column*105+14, row*105+10, 50,50);


  [button setImage:[images objectAtIndex:i] forState:UIControlStateNormal];
  [button addTarget:self 
       action:@selector(buttonClicked:) 
   forControlEvents:UIControlEventTouchUpInside];
  button.tag = i; 




  [view addSubview:button];

  if (column == 2) {
   column = 0;
   row++;
  } else {
   column++;
  }
   }
 //[view setContentSize:CGSizeMake(320, (row+1) * 80 + 10)];
    self.view = view;
 [view release]; 

can any one plz send me code for resize the images in iphone.

Thankyou in advance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜