//
// POViewController.m
// Calculator
//
// Created by hua mao on 12-9-24.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "POViewController.h"
@implementation POViewController
@synthesize display=_display;
//属性绑定到变量 obc 的属性实际上是告诉编译器有这个东西 要对他生成set get
//set get 实际是对_display 操作 既对变量操作。
//@synthesize display;
//如果如上则自动生成同名变量display.
- (IBAction)digitPressed:(UIButton *)sender {
NSString *str=[sender currentTitle];
_display.text=str;
//self.display.text=str;
}
@end
关于_xxx
根据standford那个IOS教学视频描述。
你只要应该在set get方法体内部中使用_xxx实例变量。
其他地方去使用set get方法来获取。
如 self.xx; [self xx];
本文介绍了iOS应用中POViewController的实现方式,展示了如何通过IBAction响应按钮点击事件并更新UILabel的文本内容。此外,还讨论了实例变量与属性在Objective-C中的使用规范。

被折叠的 条评论
为什么被折叠?



