Can't pass UIPickerView selection to UITextView in another UIViewController - objective-c

I have a UIViewController with a UITextView and UIButton in it. When the user clicks this button it will present a PopUp created with a UIViewController. When the Popup view loads, it displays a UIPickerView.
The problem I am having is passing the selection from the picker to the textView in the first view. I know it has to do with creating global variables, but I just can't figure out how to do it.
Anyone could help?

Related

swipe to change uiviewcontroller

I have a viewController which contains data which will remain static on the top half of the viewController. The bottom half contains 4 buttons and 4 UIViewControllers linked to the 4 buttons which are loaded earlier. And on respective button click the respective UIViewController will be show and rest of them will be hidden. I am just making viewController visible and invisible on the button click.
I want to make them change on swipe. so the UIViewController will change with the swipe and the button state for the respective UIViewController will also change with swipe.
I am not using storyboard and using xcode5.
One simple way - you can use UITabBarController to handle all this array of view controllers:https://developer.apple.com/library/ios/documentation/uikit/reference/UITabBarController_Class/Reference/Reference.html
And to change them with swipe - just add a UISwipeGestureRecognizer: https://developer.apple.com/library/ios/documentation/uikit/reference/UISwipeGestureRecognizer_Class/Reference/Reference.html like this:
UISwipeGestureRecognizer *swipeRecognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:#selector(changeTabs:)];
[self.view addGestureRecognizer:swipeRecognizer];
[swipeRecognizer release];
And in changeTabs: do this
[self.tabBarController setSelectedViewController:nextViewController];
Another more solid way is to use UIPageViewController : https://developer.apple.com/library/ios/documentation/uikit/reference/UIPageViewControllerClassReferenceClassRef/UIPageViewControllerClassReference.html
You wrote: "so the uiviewcontroller will change with the swipe and the button state for the respective uiviewcontroller will also change with swipe." - this is silly. Just use either tabs as I suggested and remove those buttons or use UIPageViewController which already has page indicators and will handle their logic itself

How to show a UIView OVER a UIPopoverController

In my app, I have my main view and when i click a button, a UIPopoverController is shown over my main view (not fullscreen so i still see the view behind) containing a UITableView. When I click one of the tableview cells, I want to show a custom view centered on screen (simple view informing the user that the app is processing) that will fade in and fade out during a specific amount of time.
The problem is that my custom view always appears UNDER the UIPopover...I tried all I can think of, bringSubviewToFront etc...Nothing works... I also tried to wrap my custom view in a UIViewController and use [mainView presentViewController:myCustomView ...] but when I do that the main view disappear
Someone can help?
Thx
Thx Ole Begemann, this question was indeed a duplicate.
Although, the solution to my problem is not to subclass UIWindow but to add my UIView to the key UIWindow :
NSArray * windows = [[UIApplication sharedApplication] windows];
UIWindow* win0 = [windows objectAtIndex:0];
[win0 addSubview:loadingView];
[win0 bringSubviewToFront:loadingWindow];

UIButton does not work when hidden

I am hiding a UIButton underneath a UITextField. Normally, the UIButton responds just find. However, when I set it to hidden (or when I set alpha to 0), it stops working.
For context, I am including a hidden button under a UITextField because the clickable area to edit the textfield is small--I'd like the user to be able to click anywhere in the neighborhood of the uitextfield in order to make the text field become the first responder. Thus, the code for the button is:
- (IBAction)enterTextField:(id)sender {
[nameTextField becomeFirstResponder];
NSLog(#"Pressed");
}
However, this code does not get called when the button is hidden. Otherwise, it does get called.
Make it a custom button with UIButtonTypeCustom or set the background to clearColor.

When loading a NSView onto a NSPanel, do I have to manually set focus to the view?

I have a NSPanel in my MainMenu.xib called filePanel, it has a NSView called filePanelView. When buttons are clicked, I will load a NSView from a nib and add it to the filePanel like this:
[NSApp activateIgnoringOtherApps:YES];
[filePanel setIsVisible:YES];
[filePanelView addSubview:[fileBrowseViewController browseView]];
The problem is that the controls on these subviews can never be brought into focus. For example, a NSTextfield that is set to be editable is not editable, and doesn't have a focus ring around it when clicked. I can click buttons though. But on another window, a determinate progress bar has it's progress measured in grey instead of blue. Is there something I'm doing wrong in terms of needing to manually set these views as having focus?

keyboard not appearing when uitextfield is pressed

I have presented a navigation controller (Nav1) as modal view controller from rootViewController
Then from Nav1 i created another navigation controller (Nav2) and presented it as modal view controller.
In nav2 when i click a table cell it pushes a view controller containing UITextField
Now the problem is when I click on UITextField it does not show iphone keyboard
Actually I am trying to make something like alarm label as in iphone clock app.
Just be sure for you have set the delegate the textfield...
[textField setDelegate:self];
why did you choose two nav controllers?
you can use tabbarcontroller by the way there is much more simpler way to achieve this.Search on google
check if
"reloadData"
is not executing before the UITextField becomes active