Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Programmatically add picker to tableview with same behavior as default keyboard
I have a tableview with a few cells. One of these contains a textfield, which shows the keyboard when selected.
Now in the tableviewcontroller class I create a UIPickerView in the viewWillAppear method, like this:
moodPickerView = [[UIPickerView alloc] initWithFrame:CGRectZero]; moodPickerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; CGSize pickerSize = [moodPickerView sizeThatFits:CGSizeZero]; moodPickerView.frame = [self pickerFrameWithSize:pickerSize]; moodPickerView.showsSelectionIndicator = YES; // note this is default to NO moodPickerView.dataSource = self; moodPickerView.delegate = self; moodPickerView.hidden = YES; [self.view addSubview:moodPickerView];
When a certain cell is selected I want to show the picker, like so:
[picker setCenter:CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height+(picker.frame.size.height/2))]; // place the pickerView outside the screen boundaries [picker setHidden:NO]; // set it to visible and then animate it to slide up [UIView beginAnimations:@\"slideIn\" context:nil]; [picker setCenter:CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height-(picker.frame.size.height/2))]; [UIView commitAnimations];
While the keyboard is up, I can still scroll in the tableview while the keyboard stays at the bottom of the screen. But, when the pickerview is up I can't.
How do I show the pickerview so it has the same behavior as the keyboard?