V8HorizontalPickerViewProtocol.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // V8HorizontalPickerViewProtocol.h
  3. //
  4. // Created by Shawn Veader on 9/17/10.
  5. // Copyright 2010 V8 Labs, LLC. All rights reserved.
  6. //
  7. @class V8HorizontalPickerView;
  8. // ------------------------------------------------------------------
  9. // V8HorizontalPickerView DataSource Protocol
  10. @protocol V8HorizontalPickerViewDataSource <NSObject>
  11. @required
  12. // data source is responsible for reporting how many elements there are
  13. - (NSInteger)numberOfElementsInHorizontalPickerView:(V8HorizontalPickerView *)picker;
  14. @end
  15. // ------------------------------------------------------------------
  16. // V8HorizontalPickerView Delegate Protocol
  17. @protocol V8HorizontalPickerViewDelegate <NSObject>
  18. @optional
  19. // delegate callback to notify delegate selected element has changed
  20. - (void)horizontalPickerView:(V8HorizontalPickerView *)picker didSelectElementAtIndex:(NSInteger)index;
  21. // one of these two methods must be defined
  22. - (NSString *)horizontalPickerView:(V8HorizontalPickerView *)picker titleForElementAtIndex:(NSInteger)index;
  23. - (UIView *)horizontalPickerView:(V8HorizontalPickerView *)picker viewForElementAtIndex:(NSInteger)index;
  24. // any view returned from this must confirm to the V8HorizontalPickerElementState protocol
  25. @required
  26. // delegate is responsible for reporting the size of each element
  27. - (NSInteger)horizontalPickerView:(V8HorizontalPickerView *)picker widthForElementAtIndex:(NSInteger)index;
  28. @end
  29. // ------------------------------------------------------------------
  30. // V8HorizontalPickerElementState Protocol
  31. @protocol V8HorizontalPickerElementState <NSObject>
  32. @required
  33. // element views should know how display themselves based on selected status
  34. - (void)setSelectedElement:(BOOL)selected;
  35. @end