我一直试图解决这个溢出问题,但似乎并非由于我做得不对的任何事情。有没有其他人遇到过这个问题并且能够修复它?
当我专注于输入文本视图布局时,默认方向会向上滑动布局,但这会与iPhone的顶部栏重叠。我该如何解决?我在下面附上了截图。
非常感谢任何帮助。
我的视图控制器:
#import "Contribute_VC.h"
#import "HomePage_VC.h"
#import "ChatViewCell.h"
@interface Contribute_VC ()
@end
@implementation Contribute_VC
(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
_AnswerView.layer.cornerRadius = 5;
_AnswerView.layer.borderColor = [UIColor whiteColor].CGColor;
_AnswerView.layer.masksToBounds = YES;
_btn_YES.layer.cornerRadius = 10;
_btn_YES.clipsToBounds = YES;
_btn_NO.layer.cornerRadius = 10;
_btn_NO.clipsToBounds = YES;
}
(IBAction)back_button:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
(void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
IBAction)buttonClicked:(id)sender {
if ( ([sender tag] == 1))
{
[_btn_Contribute setBackgroundColor: [UIColor colorWithRed:95/255.0f green:172/255.0f blue:47/255.0f alpha:1.0f]];
[_btn_Contribute setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_btn_Practice.backgroundColor = [UIColor whiteColor];
[_btn_Practice setTitleColor:[UIColor colorWithRed:95/255.0f green:172/255.0f blue:47/255.0f alpha:1.0f] forState: UIControlStateNormal];
_btn_Chat.backgroundColor = [UIColor whiteColor];
[_btn_Chat setTitleColor:[UIColor colorWithRed:95/255.0f green:172/255.0f blue:47/255.0f alpha:1.0f] forState: UIControlStateNormal];
}
if ( ([sender tag] == 2))
{
[_btn_Practice setBackgroundColor: [UIColor colorWithRed:95/255.0f green:172/255.0f blue:47/255.0f alpha:1.0f]];
[_btn_Practice setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_btn_Contribute.backgroundColor = [UIColor whiteColor];
[_btn_Contribute setTitleColor:[UIColor colorWithRed:95/255.0f green:172/255.0f blue:47/255.0f alpha:1.0f] forState:UIControlStateNormal];
_btn_Chat.backgroundColor = [UIColor whiteColor];
[_btn_Chat setTitleColor:[UIColor colorWithRed:95/255.0f green:172/255.0f blue:47/255.0f alpha:1.0f] forState:UIControlStateNormal];
}
if ( ([sender tag] == 3))
{
[_btn_Chat setBackgroundColor: [UIColor colorWithRed:95/255.0f green:172/255.0f blue:47/255.0f alpha:1.0f]];
[_btn_Chat setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_btn_Contribute.backgroundColor = [UIColor whiteColor];
[_btn_Contribute setTitleColor:[UIColor colorWithRed:95/255.0f green:172/255.0f blue:47/255.0f alpha:1.0f] forState:UIControlStateNormal];
_btn_Practice.backgroundColor = [UIColor whiteColor];
[_btn_Practice setTitleColor:[UIColor colorWithRed:95/255.0f green:172/255.0f blue:47/255.0f alpha:1.0f] forState:UIControlStateNormal];
}
}
///////// TABLE VIEW ////////////
(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 20;//getDetail.count;
}
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"ChatViewCell";
ChatViewCell*Cell = (ChatViewCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (Cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ChatViewCell" owner:self options:nil];
Cell = [nib objectAtIndex:0];
}
Cell.selectionStyle = UITableViewCellAccessoryNone;
return Cell;
}
(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 80;
}
// Use this to separate cells
(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 5;
}
(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *headerView = [[UIView alloc] init];
headerView.backgroundColor = [UIColor clearColor];
return headerView;
}
@end