Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sagarshivam

macrumors member
Original poster
May 24, 2011
51
0
Dear All!

In my very first iPhone App< i am trying to create one button(through code and not using IB) and then clicking that button, will read some file (file name is hard coded in the program) from local machine and will display the content on the iPhone.

I created button as:
Code:
- (void)loadView
{
	UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
	self.view = contentView;
	
	contentView.backgroundColor = [UIColor whiteColor];
	contentView.multipleTouchEnabled= TRUE;
    [contentView release];
	
	// Add an action button
	self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
											   initWithTitle:@"Browse" 
											   style:UIBarButtonItemStylePlain 
											   target:self 
											   action:@selector(presentSheet)] autorelease];

}

where "presentsheet" is a function that will include file opening and reading code.

Am I doing right? How to proceed in "presentsheet"?

Thnx in advance
 
Last edited by a moderator:
Why are u creating a new UIView pointer?
Ah well, for just your question. You just call an function, which you don't show. on a UIBarButtonItem.
And how to proceed in your function? well, depends, you can show a new controller there, add a subview from your file, parse it and do something with it, limitless stuff to do with it.
As long we don't know what u want, and show us that piece of code, we cannot help u i must say.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.