I have a custom button in ABNewPersonViewController. I need to enable the button, only if any(at least) one of the fields in ABNewPersonViewController is edited. Is there any way in which I can check this condition, other than writing code to check all fields independently.
You'll need some code somewhere to do this, but I'd do it by coding the existing event listener on each field to enable the button when the field being listened to is edited.
All controls have events so you can link your code to it. Example: UITextField has the event Editing Did Begin. Every controls can be linked to the same IBAction and you can recognize wich control the user changed by checking the sender param.
Related
I have a table view and in some of the cells there are links, I want to be allow the user to click on these links and view them in a webView (which I have already made). I don't want to use the row selection event because there may be more than one link in the cell. I came across TTTAttributedLabel and think it will be ideal. I don't need to add any style to the text in the cell, I only need to detect the links and capture the click event to open up my webview.
Any help would be greatly appreciated.
It looks like you can assign a TTTAttributedLabelDelegate to a TTTAttributedLabel that will get call backs for when a user selects different link types, but no opportunity for you to capture them and open your own web view (which I think is what you're trying to accomplish).
Instead, you might wanna check out OHAttributedLabel. It's similar in functionality, but when a user clicks on one of the links in the label, it calls -(BOOL)attributedLabel:(OHAttributedLabel*)attributedLabel shouldFollowLink:(NSTextCheckingResult*)linkInfo on it's OHAttributedLabelDelegate, which gives you the opportunity to handle the link tap yourself if you return NO.
What is the efficient way to validate a form in iPhone? Basic validation like if the all required textFields are filled and some validation for email and phone.
Is there way to show all the error once the submit button clicked? (I'm basically highlighting the textField red)
Any help?
You could actually show the validation before the submit button has been tapped, by using the UITextField delegate methods.
So to achieve this you would just use the textFieldDidEndEditing delegate method (documented here) to detect when the user had moved from one text field to another, and then you could immediately highlight a field red if it didn't pass your validation test.
This is a nice approach, because the user immediately knows their input won't be accepted, which can save time and frustration.
There are obviously lots of different approaches to your question, so it's really a matter of visual preference and/or style, but definitely consider doing 'in-line' validation as described above.
I am trying to create a custom keypad through a collection of buttons, which function like a regular keypad provided in iphone.
Now series of action that should occur
-text field is selected
-user presses the button
-text field is designated as first responder
-something like key event is launched so that text field is updated according to the character associated with the button.
If above supposition of flow is correct, please guide me how to get around the last step. I am newbie to iphone, so please let me know if am missing any of the basic.
Found an other way which did the needed by simulating the behaviour of keyEvent( which i doubt if exist in iphone sdk).
Basic outline of the procedure is like
-push the content to pasteboard
-call the paste function on UITextField
so when button is pressed, content corresponding to the button is copied to pasteboard and then paste function is called on the UITextField, so that the content get inserted into it.
Detailed description of steps can be found here:
http://dev.ragfield.com/2009/09/insert-text-at-current-cursor-location.html
I have a part on my app that I show the users, the files they have created and have stored inside the app's directory. I want to allow the users to rename the files.
I am wondering of doing this:
The user selects a file
The user taps on the RENAME button.
An alertview pops showing the old name and having a textview where the user can type the new name.
My question is: is this blessed by Apple? This sounds like a hack to the alertview.
Will the app be approved?
I googled around and I saw mixed opinions about that.
thanks
Generally I think the correct HIG-happy UI would be a UITableView with the list of of files. The user taps and Edit button and the page rows become editable, allowing you to delete a row/file (with a verification alert) and a disclosure arrow that pushes a detail view where you can change the name.
An alternative, though not HIG-friendly, is displaying the file name in a UITextField where the borderStyle set to UITextBorderStyleNone and the enabled set to NO. When the user taps the Rename button you change the borderStyle to UITextBorderStyleRoundedRect and enabled set to YES, setting the firstResponder to the text field so the cursor is flashing inside the textField. You'd need OK and Cancel buttons.
Or you could add a text field to the UIAlertView, also against the HIG but perhaps better.
I don't know if the property alertViewStyle was available when you make this question but searching to resolve this problem for me, I found that setting this property with UIAlertViewStylePlainTextInput resolve your problem.
Yes it is in iPhone sdk alertBox, alertBox can have the textField in which you rename the file.
check this link
for making such kind of stuff. No problem in accepting your app
You could either subclass UIAletView and add your own initWithTitle:message:...etc. method, as outlined in this tutorial, or use the undocumented [alert addTextFieldWithValue:#"" label:nil]; method, which is easier but may cause Apple to reject your app.
I am having very annoying issue. I have one form page with 5 custom cells. Each of them has one text field. On the bottom I have one button. In an onclick button function I am gathering values from each of the 5 described text fields.
My problem is that if my keyboard is up, I will get the values of not all but just visible text fields, the ones I don't see are null.
How to override this?
Thx,
Mladen
Separate data you have from your interface, that is store your textfield values in some other place right after you finish input. And access your data there.
UI elements are not intended to store data, but just to display it and allow input - as you can see in your case if you do not see a particular element you cannot be sure that it actually exists.
This might solve your problem..
1. Register your viewcontroller for KeboardNotifications
2.When keyboard will appear resize the view so that all fields will be visible.
3. When keboard will disappear just resize it back and continue..