I have been trying to fix this overflow issue but seems like it is not due to anything that I've not done right. Has anyone else experienced this issue and were able to fix it?
When I focus on an input textview layout, the default orientation slides the layout upwards but this overlaps with the top bar of the iPhone. How do I fix this? I've attached a screenshot below.
Any help is greatly appreciated.
My view controller:
#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