loginView.frame = CGRectMake(33,20,253,191);
self.view.center = CGPointMake(x,y)来移动view就可以解决键盘档住的问题, 其中x代表x轴的坐标,y代表y轴的坐标
原文址http://blog.csdn.net/dragoncheng/archive/2011/03/16/6254142.aspx
隐藏tabbar有两种方式:
1:在pushViewController之前调用
[self setHidesBottomBarWhenPushed:YES];
同时在viewWillDisappear调用:
- (void)viewWillDisappear:(BOOL)animated {
[self setHidesBottomBarWhenPushed:NO];
[super viewDidDisappear:animated];
}
2:使用函数:
- (void) hideTabBar:(BOOL) hidden{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0];
for(UIView *view in self.tabBarController.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
if (hidden) {
[view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
} else {
[view setFrame:CGRectMake(view.frame.origin.x, 433, view.frame.size.width, view.frame.size.height)];
}
}
else
{
if (hidden) {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
} else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 433)];
}
}
}
[UIView commitAnimations];
}
方式一的方法代码简单,且界面也好控制一些
PS:找了好久,都是隐藏掉tabBar, 要去掉tabBar然后重新开ToolBar什么的,我最后是选择 从基函数移除tabBarController,转到NavigationController
-------------------------UISegmentedControl---------------- 引用http://blog.163.com/scelion@126/blog/static/6373749520101022102230848/
UISegmentedControl *segmentedControl=[[UISegmentedControl alloc] initWithFrame:CGRectMake(80.0f, 8.0f, 200.0f, 30.0f) ];
[segmentedControl insertSegmentWithTitle:@"Food to eat" atIndex:0 animated:YES];
[segmentedControl insertSegmentWithTitle:@"Food to avoid" atIndex:1 animated:YES];
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
segmentedControl.momentary = YES;
segmentedControl.multipleTouchEnabled=NO;
[segmentedControl addTarget:self action:@selector(Selectbutton:) forControlEvents:UIControlEventValueChanged];
UIBarButtonItem *segButton = [[UIBarButtonItem alloc] initWithCustomView:segmentedControl];
[segmentedControl release];
self.navigationItem.rightBarButtonItem = segButton;
[segButton release];