how to detect a password text field when running in the background? - iphone

I am developing a screen recorder and facing a crazy requirement. My boss would like to have an option for a user to automatically pause recording when the current view has a password field. (That view might belong to a third-party app.)
So, is it possible to check if the topmost view has any password text field?
This is an enterprise app so private api is allowed.
Any pointer from jailbreak community is also welcome.

It would be much easier if you could just use your own views but this should work for either your own views or a third party view. BUt anyway, every time you would load up a UIView check all of its subviews, in the ViewDidLoad Method i would think and for each subview check for its class type in your case it would be UITextField. Since these are the only textfields where you can set secure text entry as its text type. Every time you find a UITExtView check if its secureTextEntry is equal to TRUE. If it is true disable the recording until that view is removed from the screen. That should be what you need.

Related

Issue using UITextField with long string

So currntly I have multiple UITextFields whose data is automatically inputted for the user when the app launches, mainly gets the location of the user and inputs them into the textfields.
Now, the issue is, when the textfields are filled, the textfields expand in width with respect to how much text is in the body of the UITextFields.
Heres a few pics of what really is going on, I'm also using nib files to create the layout, the left pic is of the application not getting an address inputted into the UITextfield from CLGeocoder coordinates, whereas the right view shows the UITextfield getting address string from the CLGeocoder.
I also notice that when I finish typing in a field, the fields EXPAND after I press return and the keyboard is dismissed.
I'm sure there is probably a setting in the nib file I uncheck or maybe I have to do this programatically? By instantiating the UITextfields programatically i mean.
As Rocky has already said, the problem is with auto-layout option of iOS 6.0. I also ran into this painful thing a while back. Turn off Auto-layout but now you will have to maintain two storyboards, one for iPhone 5 and there other for iPhone 4 and lower. Fun isn't it?
If you still decide to use auto-layout, make sure there are no User Constraints on the UITextFields where the Width is set to "Greater Than or Equal". This will allow the control to expand based on the content. If there are, just delete them.

Best way to allow text edit completion on a complex iPhone UI

I have a somewhat complex iOS view hierarchy. One piece of text is an editable UITextField. When the user touches it, it becomes first responder, and is editable.
Here's the rub, though: Best practice should be that a touch anywhere outside the edit control causes it to resign first responder and end editing. What's the best way of accomplishing this?
Techniques I've tried:
Use the exclusiveTouch property, which stops the user from interacting with other controls, but doesn't cause editing to end. Also disallows user from interacting with my toolbar "Done" button.
Put a see-through UIView under the text field control and on top of everything else (except the toolbar), and use touches there to end editing. This works, but I end up reparenting the text field onto this other random view which sits above my whole hierarchy, which means I have to take care of the text field's layout in multiple places, since it no longer lives in the place where it lived originally, and I have to delegate all its behavior back and forth from its "shield" view to its native home container, which has all the related logic.
Is there an elegant solution to this problem that I'm missing? I figure it must be a common design issue.
Thanks.
Tile 4 "see-thru" views around the textview to capture/ignore touches. Doesn't require modifying or "lifting" the textview, and can be added to the parent view in a fairly modular way.
You can't mask a region without knowing what that mask will cover and what the mask will not cover. So any solution will require enough reach to gather both of those bounds. Either pass the text rect up, or the view rect/region to be disabled down, or both to something in-between. The controller for the stuff to be covered seems as good a place as any to consolidate both rects or regions, if not the controller for the text view.
The nub of the issue is what constitutes "best practice". The fact that the keyboard remains unless the user dismisses it is deliberate. For example, many apps need the user to be able to tap a button while still working in a text field.
The keyboard has a Return button. "Best practice" is to respond to the user tapping that button by resigning first responder. Otherwise, you should leave the keyboard there, since that's what the user expects.
However, if you insist on doing it your way, there's a simple solution: put a UITapGestureRecognizer on the background view. Its handler will be triggered if the user taps on the background or on any button or similar in the interface. So, presuming you have kept a record of what the first responder is, you can send resignFirstResponder to the first responder in the tap gesture recognizer's handler.
If you change your base view to a UIControl you can add an IBAction to that layer that resigns your text field as first responder.
Also, if you have multiple touch events, make sure they each becomeFirstResponder when touched.
I'd love to have some more details to qualify my explanations xD

How to set the popup keyboard to only show certain keys?

How do you set the popup keyboard to only show certain keys when you type into a textfield? I know there are default keyboards but none seems suitable. Is there an alternative input option? Thanks.
Since iOS 3.2, you can change the keyboard :
cf.
Official documentation here
Discussion
The value of this property is nil.
Responder objects that require a
custom view to gather input from the
user should redeclare this property as
readwrite and use it to manage their
custom input view. When the receiver
subsequently becomes the first
responder, the responder
infrastructure presents the specified
input view automatically. Similarly,
when the view resigns its first
responder status, the responder
infrastructure automatically dismisses
the specified view.
This property is typically used to
replace the system-supplied keyboard
that is presented for UITextField and
UITextView objects.
Apple wont allow you to do any alterations to the keyboards..
What do you want to enter? Either create a custom keyboard, use pickers if possible or code it to not accepts certain keys..
Okay. I did'nt know you were allowed to change the keyboard now..
I usually use a picker. and have one of the segments just contain a "," the rest of the segments are 0-9..
or you could do something like this:
What is the best way to enter numeric values with decimal points?
But since its okay to change the keyboard now try this:
http://blog.devedup.com/index.php/2010/03/13/iphone-number-pad-with-a-decimal-point/

iPhone SDK: How to create a UITextView that inserts text where you tap?

I'd like to create a UITextView that you can tap anywhere within it and start typing at that location. The default behavior of the control is that typing starts where the last character ended. So, if I had a UITextView with no text in it and tap in the middle of the control, I'd like typing to start there--not in the upper left.
What is the best way to implement this behavior? I've considered making the default text value of the view to be 3000 space characters or something similar, but this seems like not an elegant solution. Suggestions?
I suggest deriving from UITextView to create a custom view that handles taps. You'll want to override the following methods, probably:
touchesBegan:withEvent
touchesMoved:withEvent
touchesEnded:withEvent
touchesCancelled:withEvent
Make sure the userInteractionEnabled property has a default value of YES. Override hitTest:withEvent and pointInside:withEvent to figure out where in your view the user tapped.
Be sure and read the Responding to Events section in the View Programming Guide for iOS, and also see the Event Handling Guide for iOS for more details.
Anyway, once you figure out where the user touched, you can modify the text or reposition the karat as appropriate.

How can I implement an autoselection textbox like the one for e-mail addresses on the iPhone?

On the iPhone's mail app, you can type in multiple mail addresses...and then to delete one you just tap it, and click Del. How can I implement something similar in my app? I tried to handle the tap on a UITextView, but it looks like the touchesBegan and related delegate methods are not fired for this class and its subclasses :(
Any idea?
I have implemented a view that is identical to what is found in the mail.app. I used a composite view comprised of a custom UIView which houses a couple of other types of views. I used a UITextField for the text entry. As the user completes an address I take the text and place it in a button with a custom background image (to get the bubble around the text look) and move the UITextField to the right (or to the next line as the case may be). When the user taps one of the address "bubbles" it is selected. If they hit the delete key I remove that bubble from the view and re-layout everything. This is a non-trivial view to build with lots of fun edge cases.
Check out Joe Hewitt three20 project, it includes "Better text fields" which can do such thing.
This could be helpful: Link
TITokenFieldView
A control which mimics the To: field in Mail and Messages. Kinda like an NSTokenField.