ios - How to increase the content view of NSScrollView horizontally? -
i using nsscrollview of size 440x44 , creating check buttons dynamically , want add them in scroll view horizontally not vertically , have added 10 buttons in scroll view this
self.scrollview.hasverticalscroller=no; self.scrollview.hashorizontalscroller=yes; int counter =0; for(int i=0;i<10;i++) { nsrect frame; frame.size.width = frame.size.height = 50; if(i>0) frame.origin.x=counter; nsbutton *mycheckbox2 = [[nsbutton alloc] initwithframe:frame]; [mycheckbox2 setbuttontype:nsswitchbutton]; [mycheckbox2 settitle:@"hello"]; [mycheckbox2 setbezelstyle:2]; [self.scrollview.documentview addsubview:mycheckbox2]; //[self.scrollview setdocumentview:mycheckbox2]; [self.scrollview addsubview:mycheckbox2]; counter=counter+50; // [self.scrollview sethorizontallinescroll:1000]; }
but problem unable scroll horizontally....... how can achieve this?
set contentsize of scrollview. that's why can't scroll. example
self.scrollview.contentsize(cgsizemake(1000,50))
Comments
Post a Comment