加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

UI类 - UITextView UIAlertView Demo

(2013-04-18 11:20:36)
标签:

it

分类: Mac/IOS那些事

十二 |--UITextView UIAlertView


--ViewController.h


#import


@interface ViewController : UIViewController <</span>UITextFieldDelegate,UIAlertViewDelegate]]>

//需要包含这两个代理协议

@property (retain, nonatomic) IBOutletUITextField *textTest;

@property (retain, nonatomic) IBOutletUILabel *lableTest;

@property (retain, nonatomic) IBOutletUIButton *buttonTest;

@property (retain,nonatomic) IBOutlet  UIAlertView *alertTest;

- (IBAction)onClick:(id)sender;


@end


--ViewController.m


#import "ViewController.h"


@interfaceViewController ()


@end


@implementation ViewController

@synthesize lableTest=_lableTest;

@synthesize buttonTest=_buttonTest;

@synthesize textTest=_textTest;

@synthesize alertTest=_alertTest;

-(BOOL)textFieldShouldReturn:(UITextField *)textField

{

    [_textTestresignFirstResponder];

     //按return的时候收回键盘

    returnYES;

}

- (void)viewDidLoad

{

    [superviewDidLoad];

    [_textTestbecomeFirstResponder];

     //当屏幕加载的时候 键盘出来 

// Do any additional setup after loading the view, typically from a nib.

}


- (void)didReceiveMemoryWarning

{

    [superdidReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}


- (void)dealloc {

    [_lableTestrelease];

    [_buttonTestrelease];

    [_textTestrelease];

    [_alertTestrelease];

    [superdealloc];

}

- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

    NSLog(@"%d",buttonIndex);

}

- (IBAction)onClick:(id)sender {

    //self.lableTest.text = @"holle world ..!!";

    self.alertTest = [[UIAlertViewalloc]initWithTitle:@"alert"message:self.lableTest.textdelegate:selfcancelButtonTitle:@"cancel"otherButtonTitles:@"ok",nil];

    [self.alertTestshow];

}

@end



0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有