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正则表达式的简单使用
- ››iPhone开发Unresolved Symbols CAKeyframeAnimati...
- ››IPhone开发-“此证书是由未知颁发机构签名”解决方...
- ››IPhone开发-整合私钥和证书,生成.p12文件
- ››iPhone应用开发-UIPickerView选取器详解
- ››iphone 获取屏幕的宽度和高度
- ››iPhone读取工程包中的二进制文件
- ››iPhone新手机 不挂YouTube APP
- ››iPhone 获取指定格式的时间和日期
- ››控件一:Gallery 之无限循环的问题
- ››控件一:Gallery 之基础用法
更多精彩
赞助商链接