iphone - UIView and UIViewController practice for inheritance -


I was thinking that this approach looks like a good practice for apps with many custom ideas for nested PNG graphics. Can change on the basis of interaction. I created a baseway class that extends UIView

  @interface BaseView: UIView {@ Protected BaseViewController * Controller; } @ Property (Maintaining) Baseview Controller * Controller; @end  

and related to the controller class which is the primary location, which I am putting code to manipulate the view

  @interface BaseViewController: UIViewController { @protected CGRAT Dreyaria; } - (Zero) Draweria: (CGRTact) _ Drarea; - (CGMATAT) Draweria; - (zero) linkview controller: (baseview controller *) _subviewController; @end  

Where "draarea" is a CGRact to be passed to see it as a frame.

"LinkSubviewController" allows you to nest a controller and see as follows:

  - (zero) linkoverview controller: (BaseviewController *) _subviewController {[ Add View Special: [_ subviewController View]]; }  

In addition to this I have another custom pair called "imageview" and "imageview controller", which extends backview, but a UI and an X, Y, W, H

In the "Drawing" drawing method on the ideas, I can see whether a wars have been changed in self.controller vars, or specify the picture, for example:

  UIImage * image = [(ImageViewController *) self.controller image];  

I write some load methods like this

  - (zero) load view {ImageView * v = [[see images new] InitVithframe: Draweria ]; V.controller = self; Self.view = v; }  

base "initWithFrame" in regular

  self.backgroundColor = [UIColor clearColor]; Self.opaque = NO;  

That is why I can load many images without transparency background without specifying each time.

I am able to use this code in my code and it seems that it is easy to write a top level class which collects the layout of the custom items. For the animation, I am putting them in the controllers and interfering myself. View.layer.

Actually I'm looking for feedback, I'm new to Objective-and-iPhone SDK

  1. Using is the wrong use of [[classname new] init ..] New < / Code>. Using new is short for , so you are effectively calling init twice
  2. The audience does not really need to know who is controlling them.
  3. Your view controller is retaining , and since UIViewController retains its view, you have one intact and never release D will be completely.

If you want this type of behavior (from which a view can delegate your drawing to a parent), try creating a DrawDelegate protocol, your Apply that protocol to the controller, and there is a non-maintainer drawing property in your visual sub-class:

  @protocol DrawDelegate - (zero) Droeria: (CGRact) Rect; @end @interface Base View: UIView {id & lt; DrawDelegate & gt; DrawDelegate; } @protect (assign) id & lt; DrawDelegate & gt; DrawDelegate; @end  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -