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]; } 

when run code achieved enter image description here

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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -