iphone - How to set bounds of actionSheet imageView? -


i need change bounds of imageview property on actionsheet,

<!-- language: lang-c -->          #pragma uiactionsheetdelegate methods         - (void)willpresentactionsheet:(uiactionsheet *)actionsheet {            /*[[[actionsheet valueforkey:@"_buttons"] objectatindex:0] imageview].frame = cgrectmake(0, 0, 25.0f, 25.0f);*/             [[[actionsheet valueforkey:@"_buttons"] objectatindex:0] imageview].bounds = cgrectmake(0, 0, 25.0f, 25.0f);             /*uiimageview *imgview = [[uiimageview alloc]initwithframe:cgrectmake(0, 0, 25.0f, 25.0f)];            imgview.image = [uiimage imagenamed:@"symbol-pin.png"];            [[actionsheet superview] addsubview:imgview];*/      } 

nothing happen after coding:

[[[actionsheet valueforkey:@"_buttons"] objectatindex:0] imageview].bounds = cgrectmake(0, 0, 25.0f, 25.0f); 

here code creating actionsheet

<!-- language: lang-c -->      - (ibaction)showmodeoptions:(id)sender {        if (!modeoptions) {          modeoptions = [[uiactionsheet alloc]initwithtitle:@"" delegate:self cancelbuttontitle:@"abbrechen" destructivebuttontitle:nil otherbuttontitles:@"pin",@"linie", @"polygon", nil];            [[[modeoptions valueforkey:@"_buttons"] objectatindex:0] setimage:[uiimage imagenamed:@"symbol-pin.png"] forstate:uicontrolstatenormal];            [[[modeoptions valueforkey:@"_buttons"] objectatindex:1] setimage:[uiimage imagenamed:@"symbol-line.png"] forstate:uicontrolstatenormal];            [[[modeoptions valueforkey:@"_buttons"] objectatindex:2] setimage:[uiimage imagenamed:@"symbol-polygon.png"] forstate:uicontrolstatenormal];            modeoptions.actionsheetstyle = uiactionsheetstyleblacktranslucent;       }       [modeoptions showfromtabbar:self.tabbarcontroller.tabbar];  } 

the images 88 x 88px , result after previos code is:

http://i46.tinypic.com/v4ck20.png 

and need images in 25 x 25 px bounds of imageview set. can me?

use following code ..

-(void)actionsheetclicked {  if(!self.modeoptions)     {         uiactionsheet *actionsheet = [[uiactionsheet alloc] initwithtitle:nil delegate:self cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles:@"dummy",nil]; //here add dummy button getting cancel button style.         self.modeoptions = actionsheet;         [actionsheet release];     }     self.modeoptions.actionsheetstyle = uiactionsheetstyleblackopaque;       [self.modeoptions showfromtabbar:self.tabbarcontroller.tabbar];//here show tab bar, can showfromview //    [self.modeoptions setbounds:cgrectmake(0, 0, 320, 300)];     uiinterfaceorientation orientation = [[uiapplication sharedapplication] statusbarorientation];     if (orientation == uiinterfaceorientationportrait ||         orientation == uiinterfaceorientationportraitupsidedown)//frame size action sheet in both modes     {         [self.modeoptions setbounds:cgrectmake(0, 0, 320, 300)];      }     else     {         [self.modeoptions setbounds:cgrectmake(0, 0, 480,250)];     }     uibutton *buttondum = (uibutton *)[[self.modeoptions subviews] objectatindex:0];      [buttondum sethidden:yes];//hide dummy button..      uibutton *cancelbutton = (uibutton *)[[self.modeoptions subviews] objectatindex:1];      if( !self.button1)     {          uibutton *btn = [[uibutton alloc]initwithframe:cgrectmake(80, 40, 70, 70)];//**here use 70 x 70 px image , can edit it**         self.button1 = btn;         [self.button1 addtarget:self action:@selector(invokefirstbtn) forcontrolevents:uicontroleventtouchupinside];         [self.button1 setimage:[uiimage imagenamed:@"btn1image.png"] forstate:uicontrolstatenormal];         [self.modeoptions addsubview:self.button1];         [btn release];     }     if( !self.button2)     {         uibutton *btn = [[uibutton alloc]initwithframe:cgrectmake(180, 40, 70, 70)];//**here use 70 x 70 px image , can edit it**         self.button2 = sharbtn;         [self.button2 addtarget:self action:@selector(invokebutton2) forcontrolevents:uicontroleventtouchupinside];         [self.button2 setimage:[uiimage imagenamed:@"btn2image.png"] forstate:uicontrolstatenormal];         [self.modeoptions addsubview:self.button2];         [btn release];     }     if (orientation == uiinterfaceorientationportrait ||         orientation == uiinterfaceorientationportraitupsidedown)//frame size action sheet in both modes     {         cancelbutton.frame = cgrectmake(50, 140, 220, 40);         self.button1.frame = cgrectmake(65, 40, 70, 70);         self.button2.frame = cgrectmake(175, 40, 70, 70);     }     else     {         cancelbutton.frame = cgrectmake(135, 140, 220, 40);         self.button1.frame = cgrectmake(155, 40, 70, 70);         self.button2.frame = cgrectmake(260, 40, 70, 70);     } } 

this working code.. check this. can change frame size wish... can create actionsheet without dummy button...


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -