my everyday notes--

MVC:divide into 3 temp:(Model;View;Controller)
Model:what your application is(but not how it is displayed);
Controller:how your Model is presented to user(UI logic);
View:your Controllers' minions(辅助);


CONNECTIONS:
1.Controller can always talk directly to their Model;
2.Controller can always talk directly to their View;(Outlet)
3.The Model and View should never speak to each other;
( the Controller an drop a target on itself,then hand out an action to the View,);
4.the View sends the ACTION when things happen in the UI;
(CONTINUE:the Controller sets itself as the View's delegate;The delegate is set via a protocol通过协议委托,but View do not own the data they display;
so, if need, they have a protocol to acquire;Controller are almost always that data source(not model!),
controllers interpret/format Model information for the View;
5.Model talk directly to the Controller?
the Model is UI independent;it use a "radio station" like broadcast mechanism,
Controller (or other Model)"tune in"to interesting stuff;


CLASS TWO:
1.Dash and Plus :
Dash for instance method;
Plus for class method;


6.Instance Variable:
  @protected__only the class and subclasses can access;
  @private__only the class can access;
  @public__anyone can access;


7.anyone can access your instance variable using dot notation:
  someObject.eye=newEyeValue;  //set the instance variable
  int eyeValue=someObject.eye; //get the instance  variable's current value
8.@property int eye;
  equal:-(int)eye:
        _(void)setEye:(int)anInt;
9.in .m:
  @implemention MyObject;
  -(int)eye {
  return eye;
 }
 -(void)setEye:(int)anInt{
 eye=anInt;
 }
 
 equal:@synthesize eye;  or @synthesize eye=p_eye;(get a different variable)


10.All objects that inherit from NSObject know these methods:
   isKindOfClass:return whether an object is that kind of class(inheritance include)
   isMemberOfClass:returns weather an object is that kind of class (no inheritance)
   respondsToSelector:returns weather an object responds to give method


   SEL is the Object-C "type" for a selector
   SEL shootSelector=@selector(shoot);
   SEL moveToSelector=@selector(moveTo:);
   Target/action uses this;e.g.:[button addTarget:self action:@selector(digitPressed:)]
  
   explain: IF you have a SEL,you can ask an object to perform it
            Using the   performSelector  :or   performSelector:withObject:methods in 
            NSObject   
        eg: [obj performSelector:shootSelector];
            [obj performSelector:moveToSelector withObject:coordination]             
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值