objective c - UIScrollView error in iOS -


i new uiscrollview. don't know how add buttons them. in app, need button in horizontal view. when tried create uiscrollview programatically, not working. throwing errors. pls me

i tried implement using storyboard too, failed dont how connect them both using viewdidload.

this code have used far:

    - (void)viewdidload {       [super viewdidload]; // additional setup after loading view.     self.layerposition = self.toplayer.frame.origin.x;      uiscrollview *scrollview =[[uiscrollview alloc]initwithframe:cgrectmake(0, 0, 320, 480)];      scrollview.showshorizontalscrollindicator=yes;      scrollview.userinteractionenabled=yes;      scrollview.scrollenabled=yes;      uibutton *button = [uibutton buttonwithtype:uibuttontyperoundedrect];     [button addtarget:self action:@selector(newview:)   forcontrolevents:uicontroleventtouchdown];      [button settitle:@"excavations",@"concrete",@"framing",@"insulation" forstate:uicontrolstatenormal];    button.frame = cgrectmake(80.0, 210.0, 160.0, 40.0);     [self.view addsubview:scrollview];    scrollview.contentsize = cgsizemake(320,960);  } 

if doing wrong pls tell me correct procedure it.

thanks

i can see 1 error in code now:

[button settitle:@"excavations",@"concrete",@"framing",@"insulation" forstate:uicontrolstatenormal];

settitle: expect 1 string, try this:

[button settitle:@"excavations" forstate:uicontrolstatenormal]; 

you want add button thou scroll view need call:

[scrollview addsubview:button]; 

it should help, if not post error.

i assume want pass uicontroleventtouchupinside instead uicontroleventtouchdown button control event.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -