You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.1 KiB

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