Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 4, 2011, 06:28 PM   #1
ITCreative
macrumors member
 
Join Date: Aug 2011
Picker View & Property list

I have Problem with Picker view , I want read the content from Property list but


I didn't know how can implement this


I try implement but the result = error .


Can help me how implement this in xcode
ITCreative is offline   0 Reply With Quote
Old Aug 5, 2011, 02:21 AM   #2
jnoxx
macrumors 65816
 
jnoxx's Avatar
 
Join Date: Dec 2010
Location: Aartselaar // Antwerp // Belgium
As most people would react, so I'll be the one to break it to you:
Check these ->
Getting Answers
And What have you tried?

Gz, Noxx
jnoxx is offline   0 Reply With Quote
Old Aug 5, 2011, 02:39 PM   #3
ITCreative
Thread Starter
macrumors member
 
Join Date: Aug 2011
^^^^

thanks a lot

I'm sorry about that.


in my code


Code:
- (void)viewDidLoad {

	NSString *myfile = [[NSBundle mainBundle] pathForResource:@"list" ofType:@"plist"];
	
	Names =[[NSArray alloc] initWithContentsOfFile:myfile];
	
	
	
	
    [super viewDidLoad];
}
but when I build this line is error


Code:
	NSString *myfile = [[NSBundle mainBundle] pathForResource:@"list" ofType:@"plist"];
ITCreative is offline   0 Reply With Quote
Old Aug 5, 2011, 06:39 PM   #4
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by ITCreative View Post
but when I build this line is error
And the error is?...

The more specific info you can provide us, the easier it'll be for us to help you.
__________________
dejo is online now   0 Reply With Quote
Old Aug 5, 2011, 07:53 PM   #5
ITCreative
Thread Starter
macrumors member
 
Join Date: Aug 2011
Ok , thanks a lot


In interface :

Code:
@interface First_AppViewController : UIViewController <UIPickerViewDelegate,UIPickerViewDataSource>

{
	NSArray *Names;

	IBOutlet UIPickerView *menuPicker;
	
}

@property (nonatomic, retain) UIPickerView *menuPicker;

@end


In implementation

Code:

@implementation First_AppViewController

@synthesize menuPicker;

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
	return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
	return Names.count;
	
}

- (NSString *)pickerView:(UIPickerView *)pickerView 
			 titleForRow:(NSInteger)row 
			forComponent:(NSInteger)component{

	return [Names objectAtIndex:row];
	
	
}




- (void)viewDidLoad {

	
	NSString *myfile = [[NSBundle mainBundle] 
						 
						pathForResource:@"list" ofType:@"plist"];
	
	Names =[[NSArray alloc] initWithContentsOfFile:myfile];
	
    [super viewDidLoad];
}


@end

but when build still the error happen
ITCreative is offline   0 Reply With Quote
Old Aug 5, 2011, 08:17 PM   #6
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by ITCreative View Post
...but when build still the error happen
I don't think you're getting the point. What is the error?
__________________
dejo is online now   0 Reply With Quote
Old Aug 5, 2011, 08:30 PM   #7
ITCreative
Thread Starter
macrumors member
 
Join Date: Aug 2011
the error happen in this line


Code:
NSString *myfile = [[NSBundle mainBundle] 
						 
		pathForResource:@"list" ofType:@"plist"];
I'm sure %100 the Resource folder contain list.plist
ITCreative is offline   0 Reply With Quote
Old Aug 5, 2011, 09:51 PM   #8
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Perhaps there is a language barrier at work here but if you can't answer a simple question, I can provide no further assistance. Sorry.
__________________
dejo is online now   0 Reply With Quote
Old Aug 5, 2011, 10:54 PM   #9
ITCreative
Thread Starter
macrumors member
 
Join Date: Aug 2011
The list.plist contain string but in Arabic becouse my app in arabic
ITCreative is offline   0 Reply With Quote
Old Aug 5, 2011, 11:28 PM   #10
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
Quote:
Originally Posted by ITCreative View Post
the error happen in this line
Code:
NSString *myfile = [[NSBundle mainBundle] 						 
pathForResource:@"list" ofType:@"plist"];
You don't answer Dejo's question. What is the error? ما هو الخطأ؟

If it is an error from the compiler when you build, tell us what that error is. If it is an error that you see in the debugger when you run, tell us what that error is.

Last edited by jiminaus; Aug 5, 2011 at 11:33 PM.
jiminaus is offline   0 Reply With Quote
Old Aug 6, 2011, 02:07 PM   #11
ITCreative
Thread Starter
macrumors member
 
Join Date: Aug 2011
the compiler just high lite this line without any comment about what is this error !!!!!!!!!!


Thumb resize.


Thumb resize.


Thumb resize.

Last edited by balamw; Aug 6, 2011 at 05:52 PM. Reason: TIMG
ITCreative is offline   0 Reply With Quote
Old Aug 6, 2011, 04:47 PM   #12
ITCreative
Thread Starter
macrumors member
 
Join Date: Aug 2011

I search about this problem


then try do just build the build now build success but when press build and debug


the problem happen

usually why problem happen in debug ?
ITCreative is offline   0 Reply With Quote
Old Aug 6, 2011, 05:20 PM   #13
ITCreative
Thread Starter
macrumors member
 
Join Date: Aug 2011
thanks a lot for all

I solve this problem
ITCreative is offline   0 Reply With Quote
Old Aug 6, 2011, 05:53 PM   #14
balamw
Moderator
 
balamw's Avatar
 
Join Date: Aug 2005
Location: New England, USA
Quote:
Originally Posted by ITCreative View Post
thanks a lot for all

I solve this problem
What did you do to solve it?

B
__________________
MBA (13" 1.7 GHz 128GB), UMBP (15" SD 2.8 GHz), UMB (13" 2.4 GHz), iMac (17" Yonah), 32GB iPad 3 WiFi+LTE, 64 GB iPad WiFi, 32 GB iPhone 5, Airport Extreme
balamw is offline   0 Reply With Quote
Old Aug 6, 2011, 07:41 PM   #15
ITCreative
Thread Starter
macrumors member
 
Join Date: Aug 2011
Just I think there is problem in viewload

So I put viewLoad in first method of implementation just this.


but Now I tray solve another problem :

Now I want If user select item from picker view the second controller display


Code:
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
	
	NSString *mylist;
	
	SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
	
	switch (row) {
			
			
		case 0: case1:
			
			mylist= [[NSBundle mainBundle] pathForResource:@"Menu" ofType:@"plist"];
			secondViewController.menu =[[NSArray alloc] initWithContentsOfFile:mylist];
			
			break;
}

but i did not know how to solve it. I try to solve it now .

Is my way true to solve ?

Last edited by ITCreative; Aug 6, 2011 at 07:55 PM.
ITCreative is offline   0 Reply With Quote
Old Aug 6, 2011, 11:20 PM   #16
ITCreative
Thread Starter
macrumors member
 
Join Date: Aug 2011
Code:
SecondViewController *anotherViewController = [[SecondViewController alloc] 
														   
														   initWithNibName:@"SecondViewController" bundle:nil];
			
			[self.navigationController pushViewController:anotherViewController animated:YES];
			
			[anotherViewController release];

in line 1: the error is : expected expression before 'SecondViewController'


in other line : the error is : anotherViewController undeclared


I think if resolve the first error the second will be resolve

but why the error 1 happen
ITCreative is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
List view in Finder w/ no icons tweaknmod OS X 1 Mar 13, 2014 08:00 PM
Why doesn't Apple let us control our own property & go back to older versions of iOS? easy-peasy iPhone 28 Feb 24, 2014 12:22 PM
Lock screen-today view-calender. List view? starstreak iOS 7 5 Sep 18, 2013 09:39 PM
DOMHTMLElement & DOMNodeList innerHTML property question... tradingjam Mac Programming 1 Jul 24, 2012 03:07 PM

Forum Jump

All times are GMT -5. The time now is 03:50 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps