SCImagePickerCell
@interface SCImagePickerCell
: SCCustomCell <UINavigationControllerDelegate,
UIImagePickerControllerDelegate, UIActionSheetDelegate,
SCViewControllerDelegate, UIScrollViewDelegate> {
UIImage *cachedImage;
UIPopoverController *popover;
UIImagePickerController *imagePickerController;
NSString *placeholderImageName;
NSString *placeholderImageTitle;
BOOL displayImageNameAsCellText;
BOOL askForSourceType;
UIButton *clearImageButton;
BOOL displayClearImageButtonInDetailView;
BOOL autoPositionClearImageButton;
BOOL autoPositionImageView;
CGRect textLabelFrame;
CGRect imageViewFrame;
NSString *selectedImageName;
}
This class functions as a cell that provides the end-user with an automatically generated detail view of type UIImagePickerController to pick an image with. As soon as the image is picked, it will be saved to the Documents folder using either an auto generated name from the current time stamp, or a name provided through SCTableViewModelDelegate or the cell’s actions. The bound property of this cell must be of type NSString, and will be bound to the name of the selected image. Once an image is selected, tapping an SCImagePickerCell will display the image in a detail view. To select a different image, the table view must be put in edit mode (make sure UITableView’s allowsSelectionDuringEditing property is TRUE). Alternatively, make sure that displayClearImageButtonInDetailView property is TRUE, and the user will be able to tap a “Clear Image” button to clear the selected image.
-
Undocumented
Declaration
Objective-C
UIImage *cachedImage
-
Undocumented
Declaration
Objective-C
UIPopoverController *popover
-
Undocumented
Declaration
Objective-C
UIImagePickerController *imagePickerController
-
Undocumented
Declaration
Objective-C
NSString *placeholderImageName
-
Undocumented
Declaration
Objective-C
NSString *placeholderImageTitle
-
Undocumented
Declaration
Objective-C
BOOL displayImageNameAsCellText
-
Undocumented
Declaration
Objective-C
BOOL askForSourceType
-
Undocumented
Declaration
Objective-C
UIButton *clearImageButton
-
Undocumented
Declaration
Objective-C
BOOL displayClearImageButtonInDetailView
-
Undocumented
Declaration
Objective-C
BOOL autoPositionClearImageButton
-
Undocumented
Declaration
Objective-C
BOOL autoPositionImageView
-
Undocumented
Declaration
Objective-C
CGRect textLabelFrame
-
Undocumented
Declaration
Objective-C
CGRect imageViewFrame
-
Undocumented
Declaration
Objective-C
NSString *selectedImageName
-
Allocates and returns an initialized SCImagePickerCell given cell text, bound object, and a bound property name.
- - parameter: cellText The text that will appear in the cell’s textLabel.
- - parameter: object The cell’s bound object (see SCTableViewCell class overview).
- - parameter: propertyName The cell’s bound property name corresponding to the cell’s selected image name. Property must be a readwrite property of type NSString.
Declaration
Objective-C
+ (instancetype)cellWithText:(NSString *)cellText boundObject:(NSObject *)object imageNamePropertyName:(NSString *)propertyName;
-
Returns an initialized SCImagePickerCell given cell text, bound object, and a bound property name.
- - parameter: cellText The text that will appear in the cell’s textLabel.
- - parameter: object The cell’s bound object (see SCTableViewCell class overview).
- - parameter: propertyName The cell’s bound property name corresponding to the cell’s selected image name. Property must be a readwrite property of type NSString.
Declaration
Objective-C
- (instancetype)initWithText:(NSString *)cellText boundObject:(NSObject *)object imageNamePropertyName:(NSString *)propertyName;
-
Set to a custom image view to use instead of the cell’s default imageView control.
Declaration
Objective-C
@property (nonatomic, strong) UIImageView *customImageView;
-
The UIImagePickerController associated with the cell. Even though this property is readonly, feel free to customize any of the controller’s relevant properties.
Declaration
Objective-C
@property (nonatomic, readonly) UIImagePickerController *imagePickerController;
-
The selected image. Returns nil if no image is selected.
Declaration
Objective-C
@property (nonatomic, readonly) UIImage *selectedImage;
-
The name for an image in the documents folder that will be used as a placeholder if no image is selected.
Declaration
Objective-C
@property (nonatomic, copy) NSString *placeholderImageName;
-
The title for the image specified in the placeholderImageName property.
Declaration
Objective-C
@property (nonatomic, copy) NSString *placeholderImageTitle;
-
If TRUE, the selected image name will be displayed in the cell’s textLabel. Default: TRUE.
Declaration
Objective-C
@property (nonatomic) BOOL displayImageNameAsCellText;
-
If TRUE, the user will be asked for the source type, otherwise, the source type will be determined from imagePickerController’s sourceType property. Default: TRUE.
Note
If the device has no camera, setting this to TRUE automatically sets the sourceType to UIImagePickerControllerSourceTypePhotoLibrary.Declaration
Objective-C
@property (nonatomic) BOOL askForSourceType;
-
A button that clears the currently selected image when tapped. Feel free to customize the default look and feel of this button.
Declaration
Objective-C
@property (nonatomic, readonly) UIButton *clearImageButton;
-
If TRUE, clearImageButton will be displayed in the cell’s detail view. Default: TRUE.
Declaration
Objective-C
@property (nonatomic) BOOL displayClearImageButtonInDetailView;
-
If TRUE, clearImageButton will be automatically positioned in the cell’s detail view. Default: TRUE.
Declaration
Objective-C
@property (nonatomic) BOOL autoPositionClearImageButton;
-
Set this property to customize the placement of the cell’s textLabel.
Declaration
Objective-C
@property (nonatomic) CGRect textLabelFrame;
-
Set this property to customize the placement of the cell’s imageView.
Declaration
Objective-C
@property (nonatomic) CGRect imageViewFrame;
-
The scroll view used to support pinch zoom on the detail view displayed image. This property is typically used to set values for ‘maximumZoomScale’.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UIScrollView *pinchZoomScrollView;
-
The name of the selected image.
Declaration
Objective-C
@property (nonatomic, copy) NSString *selectedImageName;
-
Resets the clearImageButton default layer styles such as corneRadius and borderWidth.
Declaration
Objective-C
- (void)resetClearImageButtonStyles;
-
Method responsible for saving the image to the given path.
Declaration
Objective-C
- (void)saveImage:(UIImage *)image toPath:(NSString *)imagePath;
-
Method responsible for loading image from the given path.
Declaration
Objective-C
- (UIImage *)loadImageFromPath:(NSString *)imagePath;
-
Gets called when the ‘Clear’ button is tapped.
Declaration
Objective-C
- (void)didTapClearImageButton;