我在我的应用中使用了UISearchBar
。当我在模拟器上运行时,一切都很好。在设备上不起作用。在设备上,我的搜索栏框架正在改变,但keybord未显示。 NSlog
s正在工作。我的代码是在这里:UISearchBar在模拟器上工作,但不能在设备上工作
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
NSLog(@"wrote");
}
-(BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
[self.mySearchBar setFrame:CGRectMake(0,100,mySearchBar.frame.size.width,mySearchBar.frame.size.height)];
mySearchBar.showsCancelButton=TRUE;
[email protected]"nowwrite";
NSLog(@"chosed");
}
-(void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
NSLog(@"cancel");
}
- (void)viewDidLoad
{
mySearchBar.delegate=self;
[super viewDidLoad];
}
和我的.h文件
@interface sehirRehberi : UIViewController <UISearchBarDelegate,MKMapViewDelegate,CLLocationManagerDelegate,UINavigationControllerDelegate> {
IBOutlet UISearchBar *mySearchBar;
}
@property(retain, nonatomic) UISearchBar *mySearchBar;
很难理解正在发生什么。尝试编辑您的问题并添加日志错误。谢谢。 – 2012-02-22 22:21:33
我还没有错误日志。因为我没有错误。一切似乎都没问题。但uisearchbar不工作。我的nslogs工作,但keybord没有看到 – ali10 2012-02-22 22:54:57
对不起,我在想一个错误。这很奇怪。附:类名通常以大写字母开头。 – 2012-02-22 23:01:37