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.

61 lines
2.2 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 should override both the setter and getter for this property.
  23. /// Subclasses can call super.inputValue to access a backing store for the value.
  24. @property (nonatomic) id inputValue;
  25. /// Setting this value to large will make some argument input views increase the size of their input field(s).
  26. /// Useful to increase the use of space if there is only one input view on screen (i.e. for property and ivar editing).
  27. @property (nonatomic) FLEXArgumentInputViewSize targetSize;
  28. /// Users of the input view can get delegate callbacks for incremental changes in user input.
  29. @property (nonatomic, weak) id <FLEXArgumentInputViewDelegate> delegate;
  30. // Subclasses can override
  31. /// If the input view has one or more text views, returns YES when one of them is focused.
  32. @property (nonatomic, readonly) BOOL inputViewIsFirstResponder;
  33. /// For subclasses to indicate that they can handle editing a field the give type and value.
  34. /// Used by FLEXArgumentInputViewFactory to create appropriate input views.
  35. + (BOOL)supportsObjCType:(const char *)type withCurrentValue:(id)value;
  36. // For subclass eyes only
  37. @property (nonatomic, readonly) UILabel *titleLabel;
  38. @property (nonatomic, readonly) NSString *typeEncoding;
  39. @property (nonatomic, readonly) CGFloat topInputFieldVerticalLayoutGuide;
  40. @end
  41. @protocol FLEXArgumentInputViewDelegate <NSObject>
  42. - (void)argumentInputViewValueDidChange:(FLEXArgumentInputView *)argumentInputView;
  43. @end