UIPickerView cannot display JSON array data - ios

This is my first time doing an iOS app, so I may not know some stuff that may seem easy. Please be patient with me =)
Basically, I need to fill up my UIPickerView with data from my JSON. I have successfully parsed my JSON data and pulled out what I need and placed them into an NSMutableArray. When I first tried to do the UIPickerView, I used hardcoded array, and everything was working fine. Now, when I try to replace the hardcoded array with my JSON array, I keep getting a null JSON array. The way it works, it seems that the UIPickerView tried to pull everything out before my JSON array is filled.
I have tried reloading the UIPickerView as suggested elsewhere on this site, and it also isn't working.
The following are parts of my code:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
dispatch_async(randomiserBgQ, ^{
NSData* data = [NSData dataWithContentsOfURL:randomiserCatURL];
[self performSelectorOnMainThread:#selector(fetchedData:) withObject:data waitUntilDone:YES];
});
}
- (void)fetchedData:(NSData *)responseData{
NSError* error;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
NSArray* randomiserCat = [json objectForKey:#"categories"];
self.randCatSel =[[NSMutableArray alloc] init];
NSLog(#"categories: %#", randomiserCat);
for (int i = 0; i < [randomiserCat count]; i++) {
NSDictionary *dict = [randomiserCat objectAtIndex:i];
NSString* parent = [dict objectForKey:#"name"];
[self.randCatSel addObject:parent];
NSArray* childrenArray = [dict objectForKey:#"children"];
for (int i = 0; i < [childrenArray count]; i++) {
NSDictionary* dict = [childrenArray objectAtIndex:i];
NSString* children = [dict objectForKey:#"name"];
[self.randCatSel addObject:children];
NSArray* grandchildrenArray = [dict objectForKey:#"grandchildren"];
for (int i = 0; i < [grandchildrenArray count]; i++) {
NSDictionary* dict = [grandchildrenArray objectAtIndex:i];
NSString* grandchildren = [dict objectForKey:#"name"];
[self.randCatSel addObject:grandchildren];
}
}
}
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent: (NSInteger)component
{
return [self.randCatSel count];
}
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return [self.randCatSel objectAtIndex:row];
}
As you can see, the way I tried to parse my JSON data, I used such a long method as I have a few levels of arrays in the JSON data. If there is a faster method (like foreach in PHP), please point me in the right direction as well.
So far, my UIPickerView is getting a empty randCatSel array (I presume it is loading it before it is filled).

hi please try this,
- (void)fetchedData:(NSData *)responseData
{
NSError* error;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
NSArray* randomiserCat = [json objectForKey:#"categories"];
self.randCatSel =[[NSMutableArray alloc] init];
NSLog(#"categories: %#", randomiserCat);
for (int i = 0; i < [randomiserCat count]; i++) {
NSDictionary *dict = [randomiserCat objectAtIndex:i];
NSString* parent = [dict objectForKey:#"name"];
[self.randCatSel addObject:parent];
NSArray* childrenArray = [dict objectForKey:#"children"];
for (int i = 0; i < [childrenArray count]; i++) {
NSDictionary* dict = [childrenArray objectAtIndex:i];
NSString* children = [dict objectForKey:#"name"];
[self.randCatSel addObject:children];
NSArray* grandchildrenArray = [dict objectForKey:#"grandchildren"];
for (int i = 0; i < [grandchildrenArray count]; i++) {
NSDictionary* dict = [grandchildrenArray objectAtIndex:i];
NSString* grandchildren = [dict objectForKey:#"name"];
[self.randCatSel addObject:grandchildren];
}
}
}
packerView=[[UIPickerView alloc] initWithFrame:CGRectMake(0, 280, 320, 200)];
packerView.delegate=self;
packerView.dataSource=self;
[self.view addSubview:packerView];
}
//add the picker view delegate and datasource in .h file. and set the frame as per your requirement.
hope this will help you.

As pointed out by the wonderful people here, all I had to do was to reload the UIPickerView in my fetchedData method. I previously put it in viewDidLoad =/
[pickerViewObj reloadAllComponents];
Where pickerViewObj is your own UIPickerView.

Related

Split a single NSMutableArray into two so that I can set each in each of the section in UITableView

I want to use multiple sections feature UITableView. I have a single NSMutableArray which consists of data in dictionary format. In that dictionary there is a key which has values as '0' and '1'.
I want to create two separate NSMutableArray out of that so that I can assign them accordingly in different sections.
For example :
if (indexPath.section==0) {
NSDictionary *Data = [roomList1 objectAtIndex:indexPath.row];
} else {
NSDictionary *Data = [roomList2 objectAtIndex:indexPath.row];
}
Assuming the value in your dictionary is always set you could do something like:
NSMutableArray *firstArray = [NSMutableArray new];
NSMutableArray *secondArray = [NSMutableArray new];
for (NSDictionary *dictionary in yourArray) {
if ([dictionary objectForKey:#"yourValue"] isEqualToString: #"0") {
[firstArray addObject:dictionary];
} else if ([dictionary objectForKey:#"yourValue"]isEqualToString: #"1") {
[secondArray addObject:dictionary];
}
}
You can use this
- (NSDictionary *)groupObjectsInArray:(NSArray *)array byKey:(id <NSCopying> (^)(id item))keyForItemBlock
{
NSMutableDictionary *groupedItems = [NSMutableDictionary new];
for (id item in array) {
id <NSCopying> key = keyForItemBlock(item);
NSParameterAssert(key);
NSMutableArray *arrayForKey = groupedItems[key];
if (arrayForKey == nil) {
arrayForKey = [NSMutableArray new];
groupedItems[key] = arrayForKey;
}
[arrayForKey addObject:item];
}
return groupedItems;
}
Ref: Split NSArray into sub-arrays based on NSDictionary key values
Use like this
NSMutableArray * roomList1 = [[NSMutableArray alloc] init];
NSMutableArray * roomList2 = [[NSMutableArray alloc] init];
for(int i = 0;i< YourWholeArray.count;i++)
{
if([[[YourWholeArray objectAtIndex:i] valueForKey:#"YourKeyValueFor0or1"] isEqualToString "0"])
{
[roomList1 addObject:[YourWholeArray objectAtIndex:i]];
}
else if([[YourWholeArray objectAtIndex:i] valueForKey:#"YourKeyValueFor0or1"] isEqualToString "1"])
{
[roomList2 addObject:[YourWholeArray objectAtIndex:i]];
}
}
NSMutableArray *roomList1 = [[NSMutableArray alloc] init];
NSMutableArray *roomList2 = [[NSMutableArray alloc] init];
for (NSString *key in [myDictionary allKeys]) {
if (myDictionary[key] isEqualToString: #"0") {
[roomList1 addObject: myDictionary[key]];
} else {
[roomList2 addObject: myDictionary[key]];
}
}
try this way :-
NSMutableArray *getdata=[[NSMutableArray alloc]init];
getdata=[results objectForKey:#"0"];
NSMutableArray *getdata2=[[NSMutableArray alloc]init];
getdata2=[results objectForKey:#"1"];
use this two array and populate the section with now of rows at indexpathrow
define number of section 2
if (section==0){
getdata
}
else{
getdata2
}

iOS/objective C: Display JSON feed in table

I am trying to display a JSON feed in a tableview. While there are many tutorials and questions on SO about json, none seem to address this question (without suggesting complex frameworks).
So far, I have been able to get the JSON feed into an array. I know how to display a table once you have an object as the datasource. However, I am missing the code to convert the feed into an object suitable for display in the table.
Code so far:
- (void)viewDidLoad
{
[super viewDidLoad];
//get JSON feed
dispatch_async(kBgQueue, ^{
NSData* data = [NSData dataWithContentsOfURL: kLatestKivaLoansURL];
[self performSelectorOnMainThread:#selector(fetchedData:) withObject:data waitUntilDone:YES];
});
}
//convert to array
- (void)fetchedData:(NSData *)responseData {
NSError* error;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData
NSLog(#"about to print json: %#",json);
NSArray* latestLoans = [json objectForKey:#"loans"];
}
//Code to convert FEED INTO OBJECT IS NOT WORKING: I have...
- (NSArray*) convertFeedtoObject:(NSArray*)feed {
loanObject *loan = nil;
NSMutableArray * loans = [NSMutableArray array];
NSInteger loansCount = 10;
int i;
for (i = 0; i < loansCount; i++) {
[loans addObject: loan]
}
}
//In the tableview delegate method:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//This sets datasource:
//getloans method does not exist
Loans *loan = [self.getLoans objectAtIndexPath:indexPath];
//This sets place in storyboard VC
IDTVCell *cell = [self.tableView dequeueReusableCellWithIdentifier:#"Cell"];
cell.loan = loan;
if (cell == nil) {
cell = [[IDTVCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:#"Cell"];
}
NSString * loanTitle = loan.loan;
cell.Name = loanTitle;
return cell;
}
Would appreciate any suggestions on how to get this working.
Well after fetching data you need to call
[self.tableView reloadData] and please write down the other delegate and datasource methods of tableview tableViewNumberOfRows is needed for this to work, and do set the tableview datasource and delegate to self.
EDIT
This should be your code
- (void)viewDidLoad
{
[super viewDidLoad];
dispatch_async(kBgQueue, ^{
NSData* data = [NSData dataWithContentsOfURL: kLatestKivaLoansURL];
[self performSelectorOnMainThread:#selector(fetchedData:) withObject:data waitUntilDone:YES];
});
}
- (void)fetchedData:(NSData *)responseData {
NSError* error;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData
NSLog(#"about to print json: %#",json);
NSArray* latestLoans = [json objectForKey:#"loans"];
[self.getLoans removeAllObjects];
self.getLoans = [self convertFeedtoObject:latestLoans]; //add this line
}
- (NSArray*) convertFeedtoObject:(NSArray*)feed {
loanObject *loan = nil;
NSMutableArray * loans = [NSMutableArray array];
NSInteger loansCount = 10;
int i;
for (i = 0; i < loansCount; i++) {
[loans addObject: loan]
}
[self.tableview reloadData]; //add this line
}
//add this method
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.getLoans count];
}

How to check array is empty in iPhone

I have one array of array.I want check my inner array is empty or not.and I am checking objects of array are empty string.
Here is my code :
NSMutableArray *newArray = [NSMutableArray array];
NSMutableArray *selectArray = [NSMutableArray array];
for (int i = 0; i < [newArray count]; i++)
{
NSArray *arr = [newArray objectAtIndex:i];
if ([arr count] > 0)
{
NSString *str = [arr objectAtIndex:0];
if (![str isEqualToString:#""])
{
[selectArray addObject:str];
}
}
}
my newArray is array of array.I want to add strings in selectArray which are not empty.but, only 0th index object is added in selectArray multiple times.
Please suggest me, where i am doing wrong.thanks
Thats because you are just getting the 0'th element of your newArray's elements, I mean this line
NSString *str = [arr objectAtIndex:0];
you should put another for in your code. Use this code instead of yours
NSMutableArray *newArray = [NSMutableArray array];
NSMutableArray *selectArray = [NSMutableArray array];
for (int i = 0; i < [newArray count]; i++){
NSArray *arr = [newArray objectAtIndex:i];
for (int j = 0; j < [arr count]; j++){
NSString *str = [arr objectAtIndex:j];
if (![str isEqualToString:#""]){
[selectArray addObject:str];
}
}
}
Use this code You not need to create any extra variable.
for (int i = 0; i < [newArray count]; i++)
{
for (int j = 0; j < [[newArray objectAtIndex:i] count]; j++)
{
if (![[[newArray objectAtIndex:i] objectAtIndex:j] isEqualToString:#""])
{
[selectArray addObject:str];
}
}
}
You can use following generic function to check any of the value or object is empty or null.
-(BOOL)isEmpty:(id)object{
return object == nil
|| [object isKindOfClass:[NSNull class]]
|| ([object respondsToSelector:#selector(length)]
&& [(NSData *)object length] == 0)
|| ([object respondsToSelector:#selector(count)]
&& [(NSArray *)object count] == 0);
}
You can try with this
NSMutableArray *newArray = [NSMutableArray array];
NSMutableArray *selectArray = [NSMutableArray array];
for (NSArray *arrayFromNewArray in newArray) {
if ([arrayFromNewArray count] > 0)
{
NSString *str = [arrayFromNewArray firstObject];
if (![str isEqualToString:#""])
{
[selectArray addObject:str];
}
}
}
You should be
NSMutableArray *newArray = [NSMutableArray array];
NSMutableArray *selectArray = [NSMutableArray array];
for (int i = 0; i < [newArray count]; i++)
{
NSArray *arr = [newArray objectAtIndex:i];
for (int j = 0; j < [arr count]; j++)
{
NSString *str = [arr objectAtIndex:j];
if (![str isEqualToString:#""])
{
[selectArray addObject:str];
}
}
}
Problem is you forgot the second loop :) Let me know if I am correct.

Horizontally and Vertically scrollable table view with data from json

I want to create a table view which is scrollable both horizontally and vertically. I can do this by taking values myself. But I want to take the values from json. I am using model class and my json values are like this:
[
{
"cid": 109,
"iid": 10653,
"yr": 1994,
"val": "15.4311527806175"
},
{
"cid": 109,
"iid": 7872,
"yr": 1999,
"val": "8.84575553637328"
},
{
"cid": 109,
"iid": 7872,
"yr": 1998,
"val": "6.18441582677751"
},
I want my first column to be fixed when scrolling horizontally and first row to be fixed when I scroll it vertically. First column should have iid. first row should have yr and data should have val.
I am using XCMltisortTableView, ASIHttpRequest and SBJson.
I am getting the header value and left column value. How can I get the data corresponding to the yr and iid in proper column?
My code for val in requestFinished method is as follows:
rightTableData = [NSMutableArray arrayWithCapacity:mainTableData.count];
NSMutableArray *right = [NSMutableArray arrayWithCapacity:mainTableData.count];
for (int i = 0; i < mainTableData.count; i++)
{
// Model *model = [mainTableData objectAtIndex:i];
NSMutableArray *array = [NSMutableArray arrayWithCapacity:mainTableData.count];
for (int j = 0; j < headData.count; j++)
{
Model *model = [mainTableData objectAtIndex:j];
if([headData isEqual: #"2000"])
{
[array addObject:[NSString stringWithFormat:#"%#", model.val]];
}
else if([headData isEqual: #"2001"])
{
[array addObject:[NSString stringWithFormat:#"%#", model.val]];
}
else if([headData isEqual: #"2002"])
{
[array addObject:[NSString stringWithFormat:#"%#", model.val]];
}
else if([headData isEqual: #"2003"])
{
[array addObject:[NSString stringWithFormat:#"%#", model.val]];
}
else if([headData isEqual: #"2004"])
{
[array addObject:[NSString stringWithFormat:#"%#", model.val]];
}
else
{
[array addObject:[NSString stringWithFormat:#"%#", model.val]];
}
}
[right addObject:array];
}
[rightTableData addObject:right];
I'm totally new and would a appreciate any answers and any suggestions. Please do reply.
Thanks!
After trying for a long time I got the result using the code below:
-(void) requestFinished: (ASIHTTPRequest *) request
{
NSString *theJSON = [request responseString];
SBJsonParser *parser = [[SBJsonParser alloc] init];
NSMutableArray *jsonDictionary = [parser objectWithString:theJSON error:nil];
headData = [[NSMutableArray alloc] init];
NSMutableArray *head = [[NSMutableArray alloc] init];
leftTableData = [[NSMutableArray alloc] init];
NSMutableArray *left = [[NSMutableArray alloc] init];
rightTableData = [[NSMutableArray alloc]init];
for (NSMutableArray *dictionary in jsonDictionary)
{
Model *model = [[Model alloc]init];
model.cid = [[dictionary valueForKey:#"cid"]intValue];
model.iid = [[dictionary valueForKey:#"iid"]intValue];
model.yr = [[dictionary valueForKey:#"yr"]intValue];
model.val = [dictionary valueForKey:#"val"];
[mainTableData addObject:model];
[head addObject:[NSString stringWithFormat:#"%ld", model.yr]];
[left addObject:[NSString stringWithFormat:#"%ld", model.iid]];
}
NSOrderedSet *orderedSet = [NSOrderedSet orderedSetWithArray:head];
headData = [[orderedSet array] mutableCopy];
NSOrderedSet *orderedSet1 = [NSOrderedSet orderedSetWithArray:left];
NSMutableArray *arrLeft = [[orderedSet1 array] mutableCopy];
//remove duplicate enteries from header array
[leftTableData addObject:arrLeft];
NSMutableArray *right = [[NSMutableArray alloc]init];
for (int i = 0; i < arrLeft.count; i++)
{
NSMutableArray *array = [[NSMutableArray alloc] init];
for (int j = 0; j < headData.count; j++)
{
/* NSPredicate *predicate = [NSPredicate predicateWithFormat:#"SELF.iid == %ld", [[arrLeft objectAtIndex:i] intValue]];
NSArray *filteredArray = [mainTableData filteredArrayUsingPredicate:predicate];*/
NSPredicate *predicate = [NSPredicate predicateWithFormat:#"SELF.iid == %ld AND SELF.yr == %ld", [[arrLeft objectAtIndex:i] intValue], [[headData objectAtIndex:j] intValue]];
NSArray *filteredArray = [mainTableData filteredArrayUsingPredicate:predicate];
if([filteredArray count]>0)
{
Model *model = [filteredArray objectAtIndex:0];
[array addObject:model.val];
}
}
[right addObject:array];
}
[rightTableData addObject:right];
}
Hope it helps others.

UIPickerView with changing JSON values

I am very new to Objective-C so please bear with me.
I have been working on a UIPickerView that uses JSON data and can change the values of the second component based on which option is selected on the first component.
I have used two examples I found online to try and create this, one for using JSON with a UIPickerView and one for a UIPickerView that changes the value of the second component based on the selection in the first.
I have got both of these examples working separately but can't combine them to get them to work.
I have a feeling I might be going about this the wrong way so I came here to get some help and advice.
Heres my code:
#import "ViewController.h"
#interface ViewController ()
{
NSMutableArray *Nations;
NSMutableArray *England;
NSMutableArray *Espana;
NSMutableArray *Netherlands;
NSMutableArray *Germany;
NSMutableArray *Italy;
NSDictionary *Engdict;
NSDictionary *Espdict;
NSDictionary *Netdict;
NSDictionary *Gerdict;
NSDictionary *Itadict;
// Define keys
NSString *footballclub;
NSString *team;
}
#end
#implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
Nations = [[NSMutableArray alloc]initWithObjects:#"England",#"Espana",#"Netherlands",#"Germany",#"Italy", nil];
footballclub = #"FootballClub";
England = [[NSMutableArray alloc] init];
Espana = [[NSMutableArray alloc] init];
Netherlands = [[NSMutableArray alloc] init];
Germany = [[NSMutableArray alloc] init];
Italy = [[NSMutableArray alloc] init];
NSData *EngjsonData = [NSData dataWithContentsOfURL:
[NSURL URLWithString:#"http://url./England.php"]];
NSData *EspjsonData = [NSData dataWithContentsOfURL:
[NSURL URLWithString:#"http://url.com/Espana.php"]];
NSData *NetjsonData = [NSData dataWithContentsOfURL:
[NSURL URLWithString:#"http://url.com/Netherlands.php"]];
NSData *GerjsonData = [NSData dataWithContentsOfURL:
[NSURL URLWithString:#"http://url.com/Germany.php"]];
NSData *ItajsonData = [NSData dataWithContentsOfURL:
[NSURL URLWithString:#"http://url.com/Italy.php
id EngjsonObjects = [NSJSONSerialization JSONObjectWithData:EngjsonData options:NSJSONReadingMutableContainers error:nil];
id EspjsonObjects = [NSJSONSerialization JSONObjectWithData:EspjsonData options:NSJSONReadingMutableContainers error:nil];
id NetjsonObjects = [NSJSONSerialization JSONObjectWithData:NetjsonData options:NSJSONReadingMutableContainers error:nil];
id GerjsonObjects = [NSJSONSerialization JSONObjectWithData:GerjsonData options:NSJSONReadingMutableContainers error:nil];
id ItajsonObjects = [NSJSONSerialization JSONObjectWithData:ItajsonData options:NSJSONReadingMutableContainers error:nil];
for (NSDictionary *EngdataDict in EngjsonObjects) {
NSString *strFootballClub = [EngdataDict objectForKey:#"FootballClub"];
Engdict = [NSDictionary dictionaryWithObjectsAndKeys:
strFootballClub, footballclub,
nil];
[England addObject:Engdict];
}
for (NSDictionary *EspdataDict in EspjsonObjects) {
NSString *strFootballClub = [EspdataDict objectForKey:#"FootballClub"];
Espdict = [NSDictionary dictionaryWithObjectsAndKeys:
strFootballClub, footballclub,
nil];
[Espana addObject:Espdict];
}
for (NSDictionary *NetdataDict in NetjsonObjects) {
NSString *strFootballClub = [NetdataDict objectForKey:#"FootballClub"];
Netdict = [NSDictionary dictionaryWithObjectsAndKeys:
strFootballClub, footballclub,
nil];
[Netherlands addObject:Netdict];
}
for (NSDictionary *GerdataDict in GerjsonObjects) {
NSString *strFootballClub = [GerdataDict objectForKey:#"FootballClub"];
Gerdict = [NSDictionary dictionaryWithObjectsAndKeys:
strFootballClub, footballclub,
nil];
[Germany addObject:Gerdict];
}
for (NSDictionary *ItadataDict in ItajsonObjects) {
NSString *strFootballClub = [ItadataDict objectForKey:#"FootballClub"];
Itadict = [NSDictionary dictionaryWithObjectsAndKeys:
strFootballClub, footballclub,
nil];
[Italy addObject:Itadict];
}
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 2;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent: (NSInteger)component
{
if(component ==0)
{
return [Nations count];
}
else {
if ([team isEqualToString:#"England"]) {
return [England count];
}
if ([team isEqualToString:#"Espana"]) {
return [Espana count];
}
if ([team isEqualToString:#"Netherlands"]) {
return [Netherlands count];
}
if ([team isEqualToString:#"Germany"]) {
return [Germany count];
}
else {
return [Italy count];
}
}
return 0;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
NSDictionary *EngtmpDict = [England objectAtIndex:row];
NSDictionary *EsptmpDict = [Espana objectAtIndex:row];
NSDictionary *NettmpDict = [Netherlands objectAtIndex:row];
NSDictionary *GertmpDict = [Germany objectAtIndex:row];
NSDictionary *ItatmpDict = [Italy objectAtIndex:row];
if(component ==0)
{
return [Nations objectAtIndex:row];
}
else {
if ([team isEqualToString:#"England"]) {
return [EngtmpDict objectForKey:footballclub];
}
if ([team isEqualToString:#"Espana"]) {
return [EsptmpDict objectForKey:footballclub];
}
if ([team isEqualToString:#"Netherlands"]) {
return [NettmpDict objectForKey:footballclub];
}
if ([team isEqualToString:#"Germany"]) {
return [GertmpDict objectForKey:footballclub];
}
else {
return [ItatmpDict objectForKey:footballclub];
}
}
return 0;
}
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
if (component == 0) {
team=[[NSString alloc] initWithFormat:#"%#" , [Nations objectAtIndex:row]];
[pickerView reloadComponent:1];
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)dealloc {
}
#end
This comes up in the debug screen when I try to run it.
Terminating app due to uncaught exception 'NSRangeException',
reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'

Resources