iPhone常用控件、UIActionSheet、UIAlertView
2010-12-18 08:05:25 来源:WEB开发网- (IBAction) segmentChanged: (id)sender;
- (IBAction) buttonPressed: (id)sender;
@end
//
// UntitledViewController.h
// Untitled
//
// Created by Elf Sundae on 11/10/10.
// Copyright 2010 www.cnBlogs.com/ElfSundae. All rights reserved.
//
#import
#define kSegmentIndex_Switches 0
#define kSegmentIndex_Button 1
@interface UntitledViewController : UIViewController
{
UISwitch * leftSwitch;
UISwitch * rightSwitch;
UIButton * doSomethingButton;
}
@property (retain, nonatomic) IBOutlet UISwitch *leftSwitch;
@property (retain, nonatomic) IBOutlet UISwitch *rightSwitch;
@property (retain, nonatomic) IBOutlet UIButton *doSomethingButton;
- (IBAction) switchChanged: (id)sender;
- (IBAction) segmentChanged: (id)sender;
- (IBAction) buttonPressed: (id)sender;
@end
OBJECTIVE-C CODE :UntitledViewController.m
// UntitledViewController.m
// Untitled
//
// Created by Elf Sundae on 11/10/10.
// Copyright 2010 www.cnBlogs.com/ElfSundae. All rights reserved.
//
#import "UntitledViewController.h"
@implementation UntitledViewController
@synthesize leftSwitch;@synthesize rightSwitch;@synthesize doSomethingButton;// 属性on:获取开关的状态是否为on
// 方法setOn:设置开关的状态
- (IBAction) switchChanged: (id)sender{ UISwitch *whichSwitch = (UISwitch *)sender; BOOL setting = whichSwitch.on; [leftSwitch setOn:setting animated:YES]; [rightSwitch setOn:setting animated:YES];}- (IBAction) segmentChanged: (id)sender{ switch ([sender selectedSegmentIndex]) { case kSegmentIndex_Switches:
leftSwitch.hidden = NO; rightSwitch.hidden = NO; doSomethingButton.hidden =
- ››iPhone应用帮助残障儿童看图说话
- ››iPhone实用工具AppBox Pro使用教程大揭秘
- ››iphone4省电方法
- ››iphone 获取地址的详细信息
- ››iPhone 库的基本内存管理策略
- ››iPhone加密文字亲手做 私密信息有保障
- ››iphone 根据经纬度坐标取详细地址(包括国,省,市...
- ››iphone/ipad ios cocoa object-c 近期苹果UI部分小...
- ››iphone中如何进行多线程编程
- ››iPhone OS SDK的这些事[安装、下载、版本、实例、...
- ››iPhone ObjectC的NSAutoreleasePool
- ››iPhone 判断设备是在Portrait(纵向)还是(Landscap...
更多精彩
赞助商链接