Sportica   Sportica

obj-c txt 关联。关系 txt输入框操作

//.h 文件


#import <UIKit/UIKit.h>

@interface ViewController : UIViewController<UITextFieldDelegate> // type 选择outlet 然后在后面加上。<UITextFieldDelegate>

@property (retain, nonatomic) IBOutlet UITextField *TXF; 


//.c文件 中。

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
@synthesize TXF;

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [TXF setDelegate:self];                //不要忘了这。
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

//可用于在TXT输入时的判断。在输入之前先判断。把回BOOL型
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    NSLog(@"first...\n");
    return YES;
}

@end
posted @ 2012-06-28 10:47  qingjoin  阅读(279)  评论(0编辑  收藏  举报
  Sportica