0
我正在尋找一個UITextField在觸摸時顯示UIPickerView。我在使用UITextField.inputView的同一主題上發現了很多問題。但是,當我嘗試時,沒有任何變化。UITextField顯示UIPickerView在xcode 4.3.2使用textField.inputView
我有一個非常簡單的代碼:
setupViewController.h
#import <UIKit/UIKit.h>
extern NSString *setupRightChannel;
@interface setupViewController : UIViewController
{
UITextField* rightChannelField;
UIPickerView *channelPicker;
}
@property (retain, nonatomic) IBOutlet UITextField* rightChannelField;
@property (retain, readwrite) IBOutlet UIPickerView *channelPicker;
setupViewController.m
#import "setupViewController.h"
@Interface setupViewController()
@end
@implementation setupViewController
@synthesize rightChannelField;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.title = @"Setup";
// Do any additional setup after loading the view from its nib.
rightChannelField.inputView = channelPicker;
}
-(IBAction)okClicked:(id)sender
{
setupRightChannel = rightChannelField.text;
}
我覺得我可能失去了一些東西根本,但老實說,我不認爲它是什麼。