0

I'm trying to build an app that will display stats for a certain game (I'd rather not say which one). I have most of the app completed, but I have run into a problem with my "Players" page, which is the primary view that loads after viewDidLoad. I've attached a screenshot of how it looks.

(DARN IT. I'm too new to post a pic. Available on request.)

It took some work, but I finally got my UIPickerView into place, and customized the initial options for it. You can't tell from the screenshot, but the picker loads with my player name, and one other. This will change before release.

My problem is that I want users to be able to enter their gamer name(s) in a text field, and have them always selectable from the picker after that. When they select a name in the picker, I need that action to send a string, a URL, with the player name appended to it, to every other view so that all navigation subsequent to choosing a player will show that player's data. This will allow me to load the rest of my server side graphics with ease.

Also, player names must be removable from the picker.

I'm not so lazy as to simply ask for the code, but I can't seem to figure out what components to use, or even find a tutorial that speaks to what I'm doing precisely.

1 Answers1

0

OK what i understand is you want to do two operations on the picker value select.

  1. send the url with the player name.
  2. delete the player name..(if user wants).

    Now for this you can add two buttons and as you know the value that are shown in the picker is basically you can store them in am array and load it again on picker.

so now you added two buttons one is for sending data and other is for delete.

on sendData button you can do like this to select the value from picker

     NSInteger row;
     NSArray *repeatPickerData;
     UIPickerView *repeatPickerView; //this your picker, if you defined it already dont do it.

     row = [repeatPickerView selectedRowInComponent:0];
     self.strPrintRepeat = [repeatPickerData objectAtIndex:row];

now in the "strPrintRepeat" you have the selected value. you can do what ever you want with it.

and on deleting the player name..you can do something like this.

           NSInteger row;
     NSMutableArray *repeatPickerData;  //this should be mutable
     UIPickerView *repeatPickerView; //this your picker, if you defined it already dont do it.

     row = [repeatPickerView selectedRowInComponent:0];
     [repeatePickerData removeObjectAtIndex:row];

now at this point you have the player name removed. Then you can use your UiPicker delegates to reload the picker with the updated data..

Hope that works..:) enjoy

Ajeet Pratap Maurya
  • 4,244
  • 3
  • 28
  • 46
  • Thank you so much! I'll have to see how far I get with this, but you definitely gave me what I needed. Thanks again! –  Nov 18 '11 at 16:22
  • @JustinKolenc you can mark the above answer correct if that helped you so that it will be good for other people who might have similar problem. thank you – Ajeet Pratap Maurya Nov 18 '11 at 18:56
  • I thought I did! Ha, I'm sorry. Is that not what the green checkmark is for? –  Nov 21 '11 at 11:59