FLEXArgumentInputView.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // FLEXArgumentInputView.h
  3. // Flipboard
  4. //
  5. // Created by Ryan Olson on 5/30/14.
  6. // Copyright (c) 2014 Flipboard. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. typedef NS_ENUM(NSUInteger, FLEXArgumentInputViewSize) {
  10. FLEXArgumentInputViewSizeDefault = 0,
  11. FLEXArgumentInputViewSizeLarge
  12. };
  13. @protocol FLEXArgumentInputViewDelegate;
  14. @interface FLEXArgumentInputView : UIView
  15. - (instancetype)initWithArgumentTypeEncoding:(const char *)typeEncoding;
  16. /// The name of the field. Optional (can be nil).
  17. @property (nonatomic, copy) NSString *title;
  18. /// To populate the filed with an initial value, set this property.
  19. /// To reteive the value input by the user, access the property.
  20. /// Primitive types and structs should/will be boxed in NSValue containers.
  21. /// Concrete subclasses *must* override both the setter and getter for this property.
  22. @property (nonatomic) id inputValue;
  23. /// Setting this value to large will make some argument input views increase the size of their input field(s).
  24. /// Useful to increase the use of space if there is only one input view on screen (i.e. for property and ivar editing).
  25. @property (nonatomic, assign) FLEXArgumentInputViewSize targetSize;
  26. /// Users of the input view can get delegate callbacks for incremental changes in user input.
  27. @property (nonatomic, weak) id <FLEXArgumentInputViewDelegate> delegate;
  28. // Subclasses can override
  29. /// If the input view has one or more text views, returns YES when one of them is focused.
  30. @property (nonatomic, readonly) BOOL inputViewIsFirstResponder;
  31. /// For subclasses to indicate that they can handle editing a field the give type and value.
  32. /// Used by FLEXArgumentInputViewFactory to create appropriate input views.
  33. + (BOOL)supportsObjCType:(const char *)type withCurrentValue:(id)value;
  34. // For subclass eyes only
  35. @property (nonatomic, strong, readonly) UILabel *titleLabel;
  36. @property (nonatomic, readonly) BOOL showsTitle;
  37. + (CGFloat)titleBottomPadding;
  38. @property (nonatomic, strong, readonly) NSString *typeEncoding;
  39. @end
  40. @protocol FLEXArgumentInputViewDelegate <NSObject>
  41. - (void)argumentInputViewValueDidChange:(FLEXArgumentInputView *)argumentInputView;
  42. @end