Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have an object that is very similar to this. I call it an MBlob, for MediaBlob. It knows how to do all sorts of things such as how to split itself it 2, combine with another MBlob (resizing appropriately based on the shape), etc. It also knows how to spawn itself into a WebView (loading a URL), get resized (e.g. rotation, gestures), etc. Very handy class for making little apps and I assume many developers have something similar. A similar class is used in my app store apps, QCount (free) and QPlus.</p> <p>One way to structure such as object is as a child of NSObject, then hook on some protocols for built in items you want to use. For example, my interface looks like this:</p> <pre><code>@interface MBlob : NSObject &lt;UIWebViewDelegate, UIPopoverControllerDelegate&gt; { id _delegate; } </code></pre> <p>All properties are implemented as @synthesize varName = _varName in the .m file.</p> <p>Then you can hook up all kinds of views from this item. This may be overkill, but my MBlob even knows how to launch a preferences editor to edit it's own preferences without troubling the owning VC. Here is some food for thought:</p> <pre><code>@property (nonatomic, strong) UIView* preview; @property (nonatomic, strong) UIView* displayView; @property (nonatomic, strong) UIWebView* webView; @property (nonatomic, strong) UIToolbar* toolbar; @property (nonatomic, strong) UIActivityIndicatorView* activityIndicator; @property (nonatomic, strong) NSTimer* timer; @property (nonatomic, strong) NSString* mediaType; @property (nonatomic, strong) NSString* mediaValue; @property (nonatomic) CGFloat aspectRatio; // width:height @property (nonatomic) BOOL aspectRatioLocked; @property (nonatomic) CGSize nativeSize; @property (nonatomic) CGPoint nativeLocation; @property (nonatomic, strong) NSString* title; @property (nonatomic, strong) UITextField* titleTextField; @property (nonatomic, strong) UIFont* font; @property (nonatomic) BOOL fullScreen; @property (nonatomic, strong) WebviewButtonPreferences* webviewButtonPreferences; @property (nonatomic, strong) PreferencesEditorViewController* preferencesEditorVC; </code></pre> <p>My one caution is that Apple has made a lot of things easy via the built in classes, so don't overdo it. For example in my code above, do I really need a font? I don't know, this isn't active code for my anymore, but it is an example of the kind of object you are describing. If you'll be adding more functionality, go with an umbrella subclass of NSObject and make any other class you want to use a property.</p> <p>Good luck,</p> <p>Damien</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload