iphone - how to set the scroll view contentsize dynamically? -


i had application in setting content size of scroll view dynamically according number of buttons creating array.like `

for(int =0;i<[sarray count];i++)       {          nsmutabledictionary *dicttable=[sarray objectatindex:i];          nsstring *head=[dicttable objectforkey:@"cat"];         btn= [uibutton buttonwithtype:uibuttontypecustom];         int j=i+1;         btn.frame = cgrectmake((j-1)*87,0,87, 44);         [btn setbackgroundimage:[uiimage imagenamed:@"bar.png"] forstate:uicontrolstatenormal];         [btn setbackgroundimage:[uiimage imagenamed:@"bar_hvr.png"] forstate:uicontrolstateselected];          btn.backgroundcolor = [uicolor clearcolor];          btn.titlelabel.font = [uifont fontwithname:@"helvetica-bold" size:14];          btn.titlelabel.textcolor = [uicolor whitecolor];        [btn settitle:head forstate:uicontrolstatenormal];         btn.tag = i;         [btn setshowstouchwhenhighlighted:yes];              [scroller addsubview:btn];                 [btn addtarget:self action:@selector(buttontapped:) forcontrolevents:uicontroleventtouchupinside];          if(btn.tag==0)           {             sendactionsforcontrolevents:uicontroleventtouchupinside];             }        else           {                btn.selected=no;              }       }      }           [scroller setcontentsize:cgsizemake([sarray count]*85, 44)]; 

` here problem after last button scroll view scrolls .it need not happend,i need scrolling ends last button on view,can me on this

set scrollview bounces no

scrollview.bounces = no; 

yes said looses smoothness. no other choice. if found sol please update answer.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -