FLEXArgumentInputView.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. @interface FLEXArgumentInputView : UIView
  14. - (instancetype)initWithArgumentTypeEncoding:(const char *)typeEncoding;
  15. /// The name of the field. Optional (can be nil).
  16. @property (nonatomic, copy) NSString *title;
  17. /// To populate the filed with an initial value, set this property.
  18. /// To reteive the value input by the user, access the property.
  19. /// Primitive types and structs should/will be boxed in NSValue containers.
  20. /// Concrete subclasses *must* override both the setter and getter for this property.
  21. @property (nonatomic) id inputOutput;
  22. /// Setting this value to large will make some argument input views increase the size of their input field(s).
  23. /// Useful to increase the use of space if there is only one input view on screen (i.e. for property and ivar editing).
  24. @property (nonatomic, assign) FLEXArgumentInputViewSize targetSize;
  25. // Subclasses can override
  26. /// If the input view has one or more text views, returns YES when one of them is focused.
  27. @property (nonatomic, readonly) BOOL inputViewIsFirstResponder;
  28. /// For subclasses to indicate that they can handle editing a field the give type and value.
  29. /// Used by FLEXArgumentInputViewFactory to create appropriate input views.
  30. + (BOOL)supportsObjCType:(const char *)type withCurrentValue:(id)value;
  31. // For subclass eyes only
  32. @property (nonatomic, strong, readonly) UILabel *titleLabel;
  33. @property (nonatomic, assign, readonly) const char *typeEncoding;
  34. @property (nonatomic, readonly) BOOL showsTitle;
  35. + (CGFloat)titleBottomPadding;
  36. @end