Xcode 4.2 How to make text field fullscreen - objective-c

Just a quick question, I can't seem to find any examples so far. I am trying to make a textfield in Xcode go fullscreen when users clicks on it. All i need is the code to expand the field fullscreen so other fields etc. are not visible while the user enters text. Then once the user is finished and clicks done, the previous screen returns with the text entered saved inside the field. Any ideas? Thanks

CGRect oldFrame = myTextFieldOutlet.frame;
myTextFieldOutlet.frame = CGRectMake(0,0,320,460);
...then when you want to restore it to normal...
myTextFieldOutlet.frame = oldFrame;
In fairness, I think you would be better off with a separate view for that textview you present modally (and return the text from), than what you are talking about.

Related

How to develop iOS app just like AppStore's searching function?

I want to develop a simple dictionary application which is like the Search tab of AppStore on iPhone:
The 1st screen have a SeachBar on top, the bottom is "History words" (such as "Trending Searches" on AppStore).
When user touches the SearchBar, the bottom view is gray. Touching the gray area to leave the Seach text-box and my user is able to click on one of history words.
If he/she types on SearchBar, the suggestion words list appears and he/she can click a word to see its definition with the SearchBar containing the word there (I don't want my users having to go to 2nd view to see word's definition because if so, they must click Back button to touch and type on Seach text-box. It's likely that, my application has only 1 ViewController).
I know how to work with SearchBar and TableView to display the suggestion words list but don't know what to do to implement other things:
Make a view gray; touching on the gray area to leave the Search text-box
Hide the suggestion words list (TableView) -> user can see "History words" again
Keep the SearchBar -> user can type immediately to search other word when he/she is seeing current word definition
Thanks for reading and please show me some keywords, clues to solve three issues above.
Many thanks!
Use UISearchController to create a page like you wanted.
It has dimsBackgroundDuringPresentation property to make a backgroundView gray when user is typing.
It has - (instancetype)initWithSearchResultsController:(UIViewController *)searchResultsController method. You can initialize the UISearchController with resultsController. For results you can do whatever you want.
Lastly, you can set a custom view to see "History words" to UISearchController

UIText field does not respond to touch after switching view

In my app, I have a text field that works fine, however after going back to the main menu and then back onto the page with the text field, the text field becomes un-touchable, the keyboard does not show no matter how many times you click it.
Here is a screen shot of the interface http://tinypic.com/view.php?pic=y11sm&s=6
I think I may have to add code or connect an action with the text field, but how?
Thanks for your time.
You can remove subviews that you don't use anymore like #Kim has already told you or if you need these subviews but they are blocking the action, you can bring your textfield to front using,
[your_view bringSubviewToFront: your_textfield];

How do I properly move a scrollview when assigning a first responder?

I have a form in a UIView which consist of multiple textfields, couple of textviews and two fields that are interacted with by the means of an invisible button overlaid on them. When you click on a textfield, the keyboard pops up for text entry and I added a toolbar on it for navigating to the previous and next data entry (whatever the data entry is, be it a textfield, textview or one of the two special cases that are interacted with a button). Now, when I navigate with between textfields with those buttons everything works fine. My scrollview's content moves along the element that becomes the firstresponder (with the help of a piece of code from stackoverflow that scrolls the view while taking into account the height of the keyboard that hides a good portion of it). Here is a visual example.
The problem arises when I want to switch out of a specific data entry (date) that interacts with a hidden button. I'll give some context first. Those data entries show datepickers (one for the date, another for the time) in action sheets, and those action sheets also have navigating button in a toolbar, like so.
The code from stackoverflow that readjust the view do so in the didBeginEditing delegate methods of the textfields and textviews, so when I assign them first responder the scrollview adjust itself while taking into account the keyboard.
This means that, in the case that I switch into a special data entry, I manually move the scrollview's content so I can view the next element. When I switch from a special entry into a textfield I assume that the previously mentioned code from stackoverflow kicks in and adjust the view. It actually does when I move from the hour data entry (which uses a datepicker in an actionsheet) into the next element which is a textfield. However, when I'm at the date data entry (which is directly before the hour data entry) and press previous to assign the first responder to the textfield above it, the scrollview goes way ahead the text field, like so.
What's important to note is that this problem only occurs when the textfield is not in view. This makes me suspect that I'm incorrectly using the code that readjust the view. For instance, there is a constant in the code that represents the height of the keyboard. I tried changing it from 216 to 260 (so it takes into account my toolbar added on top of the keyboard) but this results in strange black artifacts near the buttom that only occasionally appears.
I'm kind of lost in this bug, and my post is already pretty long. I've prepared an example of my problem in a new project, if any of you could take a look into it I'd be very appreciative.
Here it is

Disable all buttons until finished loading?

I have a app where people can delete stuff. I am wanting to disable all my buttons so the user has to wait till the action is done.
I have the setHidesBackButton working, but it looks tacky. I would rather have it just become inactive where if the user taps it, they can't go anywhere.
I have looked into a few things, and wonder what's the best option! (like to replace it with another button).
Please post some code with your answer :)
Thanks in advance,Coulton
Here's what I did: when it was loading, I set the user interaction like this:
self.view.userInteractionEnabled = NO;
Then when it was done, I did this:
self.view.userInteractionEnabled = YES;
Hope I helped some people.
One approach is to put a modal view with user interaction disabled over the whole screen. The view can use transparency to 'dim' the screen and you could add a UIActivityView to this view so the user knows they need to wait for a moment.
If you just want to make the buttons inactive, I've done this before with a transparent view, again set to have user interaction disabled, positioned over the navigation bar.

adding an invisible button to the background in IB

I'm working with Xcode doing a Ipad app.
i simply want user to click anywhere on screen (not counting text fields) to perform some IBAction.I'm using an invisible button that covers my whole view.
Since I have some text fields in my view,i need to add this invisible button to the background of my user interface. I cant seem to find this option in the button attributes? any help?
Just set the button's type to custom.
Did you try setting the opacity of the button to zero?
I guess i got your point. You just want to put the UIButton(invisible) on the back of all the UITextField. The simple solution to this is open the Document Window in the IB. Now expand the view tree in the list view. Just drag your UIButton above the UITextFields and set the alpha value for the button in the property to be zero.
Hope this helps!!
iPad users don't "click". They "tap" or "touch".
In Interface Builder, I believe views are constructed with a z-index from top to bottom as they appear in the document window, so dragging your button so that it appears as the first subview of your main view should be a quick fix for this.
Have you considered other approaches? This doesn't sound like standard behaviour for an app and will probably cause havoc with anybody using Voice Over. What are you trying to accomplish?