viewForFooterInSection not showing into the bottom of the screen - ios

viewForFooterInSection not showing into the bottom of the screen(uitableview).
here I am using UItableview.
Note: in below screen vary bottom of the screen one more footer added.(white color view).
Redcolorview: footer (from below code)
blue color: table background color
white bottom:
Red color view I added programmatically, using below code:
- (CGFloat)tableView:(UITableView *)tableView
estimatedHeightForFooterInSection:(NSInteger)section
{
return 44;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
NSLog(#"%f",tableView.frame.size.width);
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 44)];
view.backgroundColor = [UIColor redColor];
UIButton *cancelButton = [[UIButton alloc]initWithFrame:CGRectMake(30, 7, tableView.frame.size.width/2 - 60, 30)];
[cancelButton setTitle:#"Cancel" forState:UIControlStateNormal];
[cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[cancelButton setBackgroundColor:[ValidationsClass colorWithHexString:NSLocalizedStringFromTableInBundle(#"pothysapp_label_text_backgroundcolor",#"ApplicationSettings",[NSBundle mainBundle], nil)]];
[cancelButton addTarget:self
action:#selector(cancelDetails:)
forControlEvents:UIControlEventTouchUpInside];
cancelButton.titleLabel.font = [UIFont fontWithName:#"Roboto-Bold" size:15];
cancelButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[view addSubview:cancelButton];
UIButton *saveButton = [[UIButton alloc]initWithFrame:CGRectMake(tableView.frame.size.width/2 + 30, 7, tableView.frame.size.width/2 - 60, 30)];
[saveButton setTitle:#"Save" forState:UIControlStateNormal];
[saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[saveButton setBackgroundColor:[ValidationsClass colorWithHexString:NSLocalizedStringFromTableInBundle(#"pothysapp_label_text_backgroundcolor",#"ApplicationSettings",[NSBundle mainBundle], nil)]];
[saveButton addTarget:self
action:#selector(saveDetails:)
forControlEvents:UIControlEventTouchUpInside];
saveButton.titleLabel.font = [UIFont fontWithName:#"Roboto-Bold" size:15];
saveButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[view addSubview:saveButton];
return view;
}

Try this instead of returning your custom view in viewForFooterInSection.
Add your custom view to table footer in ViewdidLoad()
self.tableview.tableFooterView =//Your CustomView;

I removed estimatedHeightForFooterInSection and viewForFooterInSection.
Instead of this i added view in viewdidload:
self.tableview.contentInset = UIEdgeInsetsMake(0, 0, -20, 0);
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 15, self.view.frame.size.width, 30)];
view.backgroundColor = [UIColor whiteColor];
self.tableview.tableFooterView = view;
UIButton *cancelButton = [[UIButton alloc]initWithFrame:CGRectMake(30, 7, self.view.frame.size.width/2 - 60, 30)];
[cancelButton setTitle:#"Cancel" forState:UIControlStateNormal];
[cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[view addSubview:cancelButton];
UIButton *saveButton = [[UIButton alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2 + 30, 7, self.view.frame.size.width/2 - 60, 30)];
[saveButton setTitle:#"Save" forState:UIControlStateNormal];
[saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[view addSubview:saveButton];

Related

UINavigationController centered button using obj-c

I'm trying to add a centered button in my navbar header, confused as to how I can do it
- (void)viewDidLoad {
[super viewDidLoad];
UIImage *meImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:#"%#/me.png", kSelfBundlePath]];
UIBarButtonItem *meButton = [[UIBarButtonItem alloc] initWithImage:meImage style:UIBarButtonItemStylePlain target:self action:#selector(twitterButton)];
[self.titleView //i read this can be used to like set it but i havent been able to figure it out
help would be appreciated, pretty new
check this code
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
container.backgroundColor = [UIColor clearColor];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setFrame:CGRectMake(0, 0, 44, 44)];
[btn setBackgroundImage:[UIImage imageNamed:#"button0.png"] forState:UIControlStateNormal];
[btn addTarget:self action:#selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
[btn setShowsTouchWhenHighlighted:YES];
[buttonContainer addSubview:button0];
//add your spacer images and button1 and button2...
self.navigationItem.titleView = container;
You can try like this way
UIView *topView = [[UIView alloc]initWithFrame:CGRectZero];
UIButton * button = [[UIButton alloc]initWithFrame:CGRectZero];
[button addTarget:self action:#selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
[button setTitle:#"Title here" forState:UIControlStateNormal];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button sizeToFit];
[topView addSubview:button];
[topView sizeToFit];
self.navigationItem.titleView = topView;
-(void)buttonAction:(Id) sender {
NSLog(#"button clicked");
}
I think its pretty straight, you can use titleView property of UINavigationItem :
-(void)addCenterButton {
UIImage *meImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:#"%#/me.png", kSelfBundlePath]];
UIButton *button = [[UIButton alloc] initWithFrame::CGRectMake(0, 0, 40, 20)];
[button setImage:meImage forState:UIControlStateNormal];
[button addTarget:self action:#selector(twitterButton) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.titleView = button;
}

custom UITableViewCell doesn't show data before showing full cell when scrolling

My application has custom UITableViewCell with large height 470px.
I created custom cell with fully programatically.
This is my cellForRowAtIndexPath method
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
pixDealsTableViewCell *dealCell = (pixDealsTableViewCell *)[tableView dequeueReusableCellWithIdentifier:#"Deals" forIndexPath:indexPath];
if (dealCell == nil) {
dealCell = [[pixDealsTableViewCell alloc] init];
}
dealCell.dBusinessLogo.image = [pixUtil imageWithImage:[UIImage imageNamed:#"profile_icon"] scaledToSize:CGSizeMake(60, 60)];
[dealCell.dBusinessName setTitle:#"Business Name" forState:UIControlStateNormal];
dealCell.dTimeAgo.text = [NSString stringWithFormat:#"5 min ago"];
[dealCell.dHeading setTitle:#"Deals Head" forState:UIControlStateNormal];
[dealCell.dDescription setTitle:#"Descriptionskjdfnkjsdnfis" forState:UIControlStateNormal];
dealCell.dImage.image = [pixUtil imageWithImage:[UIImage imageNamed:#"carrier.png"] scaledToSize:CGSizeMake(290, 250)];
[dealCell.dLike setTitle:#"Like" forState:UIControlStateNormal];
[dealCell.dShare setTitle:#"Share" forState:UIControlStateNormal];
return dealCell;
}
This is my custom cell init method
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
NSLog(#"NEW CELL");
customRed = [[UIColor alloc]initWithRed:209.0f/255.0f green:19.0f/255.0f blue:38.0f/255.0f alpha:1.0f];
[self setBackgroundColor:[UIColor grayColor]];
containerCell = [[UIView alloc]initWithFrame:CGRectMake(10, 10, 300, 700)];
[containerCell setBackgroundColor:[UIColor whiteColor]];
self.dBusinessLogo = [[UIImageView alloc]initWithFrame:CGRectMake(15, 15, 60, 60)];
self.dBusinessName = [[UIButton alloc]initWithFrame:CGRectMake(80, 20, 225, 20)];
[self.dBusinessName setTitle:#"Business Name" forState:UIControlStateNormal];
self.dBusinessName.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[self.dBusinessName addTarget:self action:#selector(haveAccount:) forControlEvents:UIControlEventTouchUpInside];
[self.dBusinessName setTitleColor:customRed forState:UIControlStateNormal];
self.dTimeAgo = [[UILabel alloc]initWithFrame:CGRectMake(80, 50, 225, 15)];
self.dHeading = [[UIButton alloc]initWithFrame:CGRectMake(15, 80, 290, 20)];
self.dHeading.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[self.dHeading addTarget:self action:#selector(haveAccount:) forControlEvents:UIControlEventTouchUpInside];
[self.dHeading setTitleColor:customRed forState:UIControlStateNormal];
self.dDescription = [[UIButton alloc]initWithFrame:CGRectMake(15, 105, 290, 50)];
self.dDescription.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[self.dDescription addTarget:self action:#selector(haveAccount:) forControlEvents:UIControlEventTouchUpInside];
[self.dDescription setTitleColor:customRed forState:UIControlStateNormal];
self.dImage = [[UIImageView alloc]initWithFrame:CGRectMake(15, 160, 290, 250)];
self.dLike = [[UIButton alloc]initWithFrame:CGRectMake(10, 420, 150, 40)];
self.dLike.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[self.dLike addTarget:self action:#selector(haveAccount:) forControlEvents:UIControlEventTouchUpInside];
[self.dLike setTitleColor:customRed forState:UIControlStateNormal];
self.dShare = [[UIButton alloc]initWithFrame:CGRectMake(160, 420, 150, 40)];
self.dShare.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[self.dShare addTarget:self action:#selector(haveAccount:) forControlEvents:UIControlEventTouchUpInside];
[self.dShare setTitleColor:customRed forState:UIControlStateNormal];
[self.contentView addSubview:containerCell];
[self.contentView addSubview:self.dBusinessLogo];
[self.contentView addSubview:self.dBusinessName];
[self.contentView addSubview:self.dTimeAgo];
[self.contentView addSubview:self.dHeading];
[self.contentView addSubview:self.dDescription];
[self.contentView addSubview:self.dImage];
[self.contentView addSubview:self.dShare];
// NSLog(#"Deals View added");
}
return self;
}
This is my UITableViewCell fully viewed.
When I scroll down to next cell, It doesn't load properly.
It loads correctly after fully scrolled the cell to up
Please Help me to solve this problem.
Finally I got answer. I created containerCell view with height of 700. But cell height is 470 only.
I changed that containerCell view height to 470. Its fixed my problem. :)

Adjusting the height of a uitableview section footer

I am just starting to use a UITableView section footer, but am having some problems. So I have a UITableView with an edit button attached to the bottom using a footer. My first problem is that when you click on that button, the footer should double in size because the edit button then becomes an add button and a done button, instead of just one button. What would be the best way to make the size of the footer bigger. I have tried changing the frame of the footer through self.tableView.tableFooterView.frame = CGRectMake(0, 0, 320, 88); but this does not work.
My second problem is that I would like the footer to always scroll with the table, like it is just another cell. It should just be located at the bottom of the table no matter what. If the user scrolls down, it should not stop at the bottom of the screen and stick, it should just keep scrolling with the rest of tableview. How would I fix this?
Here is how I am creating the footer:
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 48;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
//view.backgroundColor = [UIColor grayColor];
self.addButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.addButton.frame = CGRectMake(0, 0, 320, 44);
[self.addButton setImage:[UIImage imageNamed:#"Add_Class_Button"] forState:UIControlStateNormal];
[self.addButton setImage:[UIImage imageNamed:#"Add_Class_Button"] forState:UIControlStateHighlighted];
[self.addButton addTarget:self action:#selector(addSelected:) forControlEvents:UIControlEventTouchUpInside];
self.addButton.hidden = YES;
[view addSubview:self.addButton];
self.editButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.editButton.frame = CGRectMake(0, 0, 320, 44);
[self.editButton setImage:[UIImage imageNamed:#"Edit_Classes_Button"] forState:UIControlStateNormal];
[self.editButton setImage:[UIImage imageNamed:#"Edit_Classes_Button"] forState:UIControlStateHighlighted];
[self.editButton addTarget:self action:#selector(editSelected:) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:self.editButton];
self.editDoneButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.editDoneButton.frame = CGRectMake(0, self.addClassButton.frame.size.height-2, 320, 44);
[self.editDoneButton setImage:[UIImage imageNamed:#"Edit_Classes_Button"] forState:UIControlStateNormal];
[self.editDoneButton setImage:[UIImage imageNamed:#"Edit_Classes_Button"] forState:UIControlStateHighlighted];
[self.editDoneButton addTarget:self action:#selector(doneSelected) forControlEvents:UIControlEventTouchUpInside];
self.editDoneButton.hidden = YES;
[view addSubview:self.editDoneButton];
self.editLabel = [[UILabel alloc] init];
self.editLabel.frame = CGRectMake(10, 5, 100, 30);
self.editLabel.text = #"Edit";
self.editLabel.font = [UIFont fontWithName:#"HelveticaNeue" size:17];
[view addSubview:self.editLabel];
self.addLabel = [[UILabel alloc] init];
self.addLabel.frame = CGRectMake(10, 5, 100, 30);
self.addLabel.text = #"Add";
self.addLabel.font = [UIFont fontWithName:#"HelveticaNeue" size:17];
self.addLabel.hidden = YES;
[view addSubview:self.addLabel];
self.editDoneLabel = [[UILabel alloc] init];
self.editDoneLabel.frame = CGRectMake(10, self.addClassButton.frame.size.height + 5, 150, 30);
self.editDoneLabel.text = #"Done";
self.editDoneLabel.font = [UIFont fontWithName:#"HelveticaNeue" size:17];
self.editDoneLabel.hidden = YES;
[view addSubview:self.editDoneLabel];
self.theLine = [[UIView alloc] init];
self.theLine.frame = CGRectMake(0, 0, 320, .5);
UIColor *borderColor = [UIColor colorWithRed:193/255.5 green:193/255.0 blue:193/255.0 alpha:1.0];
self.theLine.backgroundColor = borderColor;
[view addSubview:self.theLine];
return view;
}
Edit
After the taking into account the answers bellow, this is what I have switched to, but now where my footer used to be, there is just a grey rectangle.
Here is the code that I am now using:
-(void)setUpFooter {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 48)];
view.backgroundColor = [UIColor redColor];
self.addButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.addButton.frame = CGRectMake(0, 0, 320, 44);
[self.addButton setImage:[UIImage imageNamed:#"Add_Class_Button"] forState:UIControlStateNormal];
[self.addButton setImage:[UIImage imageNamed:#"Add_Class_Button"] forState:UIControlStateHighlighted];
[self.addButton addTarget:self action:#selector(addSelected:) forControlEvents:UIControlEventTouchUpInside];
self.addButton.hidden = YES;
[view addSubview:self.addButton];
self.editButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.editButton.frame = CGRectMake(0, 0, 320, 44);
[self.editButton setImage:[UIImage imageNamed:#"Edit_Classes_Button"] forState:UIControlStateNormal];
[self.editButton setImage:[UIImage imageNamed:#"Edit_Classes_Button"] forState:UIControlStateHighlighted];
[self.editButton addTarget:self action:#selector(editSelected:) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:self.editButton];
self.editDoneButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.editDoneButton.frame = CGRectMake(0, self.addClassButton.frame.size.height-2, 320, 44);
[self.editDoneButton setImage:[UIImage imageNamed:#"Edit_Classes_Button"] forState:UIControlStateNormal];
[self.editDoneButton setImage:[UIImage imageNamed:#"Edit_Classes_Button"] forState:UIControlStateHighlighted];
[self.editDoneButton addTarget:self action:#selector(doneSelected) forControlEvents:UIControlEventTouchUpInside];
self.editDoneButton.hidden = YES;
[view addSubview:self.editDoneButton];
self.editLabel = [[UILabel alloc] init];
self.editLabel.frame = CGRectMake(10, 5, 100, 30);
self.editLabel.text = #"Edit";
self.editLabel.font = [UIFont fontWithName:#"HelveticaNeue" size:17];
[view addSubview:self.editLabel];
self.addLabel = [[UILabel alloc] init];
self.addLabel.frame = CGRectMake(10, 5, 100, 30);
self.addLabel.text = #"Add";
self.addLabel.font = [UIFont fontWithName:#"HelveticaNeue" size:17];
self.addLabel.hidden = YES;
[view addSubview:self.addLabel];
self.editDoneLabel = [[UILabel alloc] init];
self.editDoneLabel.frame = CGRectMake(10, self.addClassButton.frame.size.height + 5, 150, 30);
self.editDoneLabel.text = #"Done";
self.editDoneLabel.font = [UIFont fontWithName:#"HelveticaNeue" size:17];
self.editDoneLabel.hidden = YES;
[view addSubview:self.editDoneLabel];
self.theLine = [[UIView alloc] init];
self.theLine.frame = CGRectMake(0, 0, 320, .5);
UIColor *borderColor = [UIColor colorWithRed:193/255.5 green:193/255.0 blue:193/255.0 alpha:1.0];
self.theLine.backgroundColor = borderColor;
[view addSubview:self.theLine];
view.userInteractionEnabled = YES;
self.classTableView.tableFooterView = view;
self.classTableView.tableFooterView.userInteractionEnabled = YES;
}
hope I can help.
To set the section footer height you also have to change the returned value in the method heightForFooterInSection. To reload the height you can call [tableView reloadData] or [tableView reloadSections:...].
A table section footer always stick to the bottom of the screen but there is a different view used to place things after the table view.
The tableView.tableFooterView is a view that is located after the table view. Change this to add elements after the table view.
Cheers!
There are two types of footers in a UITableView. There is the table footer at the bottom of the table, and there is the table section footer at the bottom of each section.
It sounds like you want to use table section headers. However, your code snippet is setting the frame of the table footer, not the table section footers.
self.tableView.tableFooterView.frame = CGRectMake(0, 0, 320, 88);
If you want to adjust the table section footer height, the tableView:heightForFooterInSection: method will need to return a different value.

iOS : Cannot click the right side of UINavigationItem

-(void )SetNavBarView{
searchBarBtn.hidden=YES;
UIView *NavBarView ;
NavBarView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 44)];
UIButton *btn1 = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
btn1.titleLabel.font=[UIFont systemFontOfSize:14];
[btn1 setBackgroundImage:[UIImage imageNamed:#"list.png"] forState:UIControlStateSelected];
[btn1 setBackgroundImage:[UIImage imageNamed:#"nine_grid.png"] forState:UIControlStateNormal];
btn1.tag=10;
[btn1 addTarget:self action:#selector(btnBarClick:) forControlEvents:UIControlEventTouchUpInside];
[NavBarView addSubview:btn1];
UIButton *btn2 = [[UIButton alloc] initWithFrame:CGRectMake(45, 0, 44, 44)];
btn2.titleLabel.font=[UIFont systemFontOfSize:14];
[btn2 setBackgroundImage:[UIImage imageNamed:#"map.png"] forState:UIControlStateNormal];
btn2.tag=11;
[btn2 addTarget:self action:#selector(btnBarClick:) forControlEvents:UIControlEventTouchUpInside];
[NavBarView addSubview:btn2];
UILabel *labtitle=[[UILabel alloc]initWithFrame:CGRectMake(95, 0, 120, 44)];
labtitle.text=NSLocalizedString(#"people_nearby", nil);
labtitle.textColor=[UIColor whiteColor];
labtitle.backgroundColor=[UIColor clearColor];
labtitle.textAlignment=UITextAlignmentCenter;
labtitle.font=[UIFont boldSystemFontOfSize:20.0];
[NavBarView addSubview:labtitle];
UIButton *btn3 = [[UIButton alloc] initWithFrame:CGRectMake(135, 0, 95, 44)];
btn3.tag=12;
[btn3 addTarget:self action:#selector(btnBarClick:) forControlEvents:UIControlEventTouchUpInside];
[NavBarView addSubview:btn3];
arrowImage=[[UIImageView alloc]initWithFrame:CGRectMake(75, 16, 10, 10)];
arrowImage.image=[UIImage imageNamed:#"arrow_down.png"];//arrow_down.png
[btn3 addSubview:arrowImage];
UIButton *btn4 = [[UIButton alloc] initWithFrame:CGRectMake(230, 0, 44, 44)];
btn4.titleLabel.font=[UIFont systemFontOfSize:14];
[btn4 setBackgroundImage:[UIImage imageNamed:#"ic_action_search.png"] forState:UIControlStateNormal];
btn4.tag=13;
[btn4 addTarget:self action:#selector(btnBarClick:) forControlEvents:UIControlEventTouchUpInside];
[NavBarView addSubview:btn4];
// [bubble stretchableImageWithLeftCapWidth:20 topCapHeight:14]
UIButton *btn5 = [[UIButton alloc] initWithFrame:CGRectMake(275, 0, 44, 44)];
btn5.backgroundColor=[UIColor redColor];
[btn5 setBackgroundImage:[UIImage imageNamed:#"location.png" ] forState:UIControlStateNormal];
btn5.tag=14;
[btn5 addTarget:self action:#selector(btnBarClick:) forControlEvents:UIControlEventTouchUpInside];
[NavBarView addSubview:btn5];
NavBarView.hidden=NO;
// [self.view addSubview:NavBarView];
self.navigationItem.titleView=NavBarView;
}
I have a UINavigationItem , which has five buttons. The fifth button btn5 can only click the left side, but the right of the btn5 cannot be clicked. ( Size of the button is 44 x 44 )
It's because of the size of UINavigationBarItem, it will by default leave a 14px around both sides. If you give a background color to your first button, then you see that space.

How to programmatically add objects/views on a UIScrollView?

I've been using Interface Builder and storyboard to make my application, but for this signature capturing API, everything was done in code.
I'm trying to implement it to my application, but I can't figure out how to add an UIView and Buttons on to my scrollview.
I got it to appear in my view controller, but it isn't connected to the scrollview at all; it appears on top.
Here's my code.
- (void)viewDidLoad
{
[super viewDidLoad];
CGFloat padding = self.view.frame.size.width/15;
UIView *autoGraphView = [[[UIView alloc] initWithFrame:CGRectMake(padding, 300, 280, 160)] autorelease];
autoGraphView.layer.borderColor = [UIColor lightGrayColor].CGColor;
autoGraphView.layer.borderWidth = 3;
autoGraphView.layer.cornerRadius = 10;
[autoGraphView setBackgroundColor:[UIColor whiteColor]];
[self.view addSubview:autoGraphView];
self.autoGraph = [T1Autograph autographWithView:autoGraphView delegate:self];
[autoGraph setLicenseCode:#"4fabb271f7d93f07346bd02cec7a1ebe10ab7bec"];
[autoGraph setShowDate:YES];
[autoGraph setShowHash:YES];
UIButton *clearButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
// init withFrame:CGRectMake (50, 300, 200, 60)];
[clearButton setFrame:CGRectMake(padding, 480, 130, 30)];
[clearButton setTitle:#"Clear" forState:UIControlStateNormal];
[clearButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[clearButton addTarget:self action:#selector(clearButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:clearButton];
UIButton *autoDone = [UIButton buttonWithType:UIButtonTypeRoundedRect];
// initWithFrame:CGRectMake (50, 300, 200, 60)];
[autoDone setFrame:CGRectMake(150 + padding, 480, 130, 30)];
[autoDone setTitle:#"Done" forState:UIControlStateNormal];
[autoDone setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[autoDone addTarget:self action:#selector(doneButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:autoDone];
}
You need to add the subviews to the scrollview, if the root view of your viewcontroller is not the scrollview, you need to get access to it one way or another, typically through an IBOutlet, and add them that way

Resources