How to remove default iCarousel item centered position? -


anyone can me out, how remove default icarousel item centered position example?

i had same problem , following hack ;)

problem: need have view display 3 items left aligned.

resolution: have done make @ least 3 items. if have 0, 1 or 2 items i'm creating 3, not need shown i'm creating empty uiview. have 2 placeholders, in cases 1 or both empty.

e.g. if have 2 items display, i'm creating three, third 1 empty uiview. i'm creating 2 placeholders , 1 item.

  • first item first placeholder @ index 0
  • second item item
  • third item second placeholder empty uiview

if have 1 items display, again i'm creating three, second , third 1 empty uiview. same in previous example, i'm creating 2 placeholders , 1 item.

  • first item first placeholder @ index 0
  • second item item empty uiview
  • third item second placeholder empty uiview

because of logic i'm cleaning view when reusing ([v removefromsuperview]), sure clean , if new 1 needs displayed i'm adding ([view addsubview...). same logic item , placeholder

if need have more 3 displayed items can use same logic, change value 3 else. if i'm wrong update me ;)

here part of mine code works me ;)

- (nsuinteger)numberofitemsincarousel:(icarousel *)carousel {     return [[self getrecordings] count] > 3? [[self getrecordings] count] - 2: 1; }  - (uiview *)carousel:(icarousel *)carousel viewforitematindex:(nsuinteger)index reusingview:(uiview *)view {     if (view == nil)     {         view = [[uiview alloc] initwithframe:cgrectmake(0, 0, 50, 30)];     }     else     {         // if reusing remove content holder view fake items         (uiview *v in view.subviews)         {             [v removefromsuperview];         }     }      if ([[self getrecordings] count] >= 2)     {         [view addsubview:[(recordingitemviewcontroller*)[_recordingitemviewcontrollers objectatindex:index + 1] view]];     }      return view; }  - (nsuinteger)numberofplaceholdersincarousel:(icarousel *)carousel {     return 2; }  - (uiview *)carousel:(icarousel *)carousel placeholderviewatindex:(nsuinteger)index reusingview:(uiview *)view {     if (view == nil)     {         view = [[uiview alloc] initwithframe:cgrectmake(0, 0, 50, 30)];     }     else     {     // if reusing remove content holder view fake items         (uiview *v in view.subviews)         {             [v removefromsuperview];         }     }      if (([[self getrecordings] count] > 0 && [[self getrecordings] count] < 3 && index == 0) || [[self getrecordings]count] >= 3)     {         [view addsubview:[(recordingitemviewcontroller*)(index == 0? [_recordingitemviewcontrollers objectatindex:0]: [_recordingitemviewcontrollers lastobject]) view]];     }      return view; } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -