possibility of setting the Voice Over Cursor in Objective-C - objective-c

I am programming a text-based RPG for Voice-Over users on the iPhone.
I've got multiple UIViews added to my viewcontroller for different events.
I often remove and add them to my main View.
My Question is as follows: is it possible to update the VoiceOver Cursor to focus on the first Element on the View so the User doesn't has to check every Time if there has happened something new?
I figured out that this happens in a Navigationcontroller.
Is there a functionality to do this?

By posting a UIAccessibilityLayoutChangedNotification, you inform VoiceOver that the layout of the screen has changed. You can also use UIAccessibilityAnnouncementNotification if you want to make a specific announcement.
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
Reference: UIAccessibility Protocol Introduction, Notifications

You can't control the VoiceOver cursor in iOS 4 or 5. I wish you could, it would solve so many issues.
I think this will be possible with iOS 6. See this answer for more info on that: https://stackoverflow.com/a/11995385/1455770

Related

Create a Mention friend in iOS with Objective-C

still learning iOS development, want to create something like mention friend likes in Facebook / Instagram.
Mention People UI in Instagram
Is it using new TableViewController and add subview to the same View Controller? (in this case, CommentViewController) , but, when i already have UITAbleViewController in my CommentViewController, how can i handle the second tableviewcontroller?
Looking at the image you provided it looks as though the best way to implement this would be a UIViewController that has a UITableView added to it. Each tableview that is created can have a delegate and datasource set for it. When the textview detects that a mention is being entered (more about detecting this later) you would trigger a second tableview to appear as an additional view (subview) that overlays your current tableview (or as the accessory view of the keyboard, the way apple and others present a textview over the keyboard for text entry ex: messages app).
In order to manage the two tableviews my suggestion would be to create two additional classes each of which conform to the UITableViewDelegate and UITableViewData source. The first one would be the CommentsTableViewManager and the second would be the MentionsTableViewManager. The first tableview would set the CommentsTableViewManager as its delegate and datasource while the second would use the MentionsTableViewManager.
The other problem you may run into later on is determining how to properly detect mentions being typed into the textview. I've actually created an open source library that will help you with this problem. It's located here: https://github.com/szweier/SZMentionsSwift the README should provide enough information for you to get started if you choose to use it.
I hope the information about helps get you started with your app.
From architecture prospective it's way better to have a single table view with altered data source container, depending on current mode.
Speaking an instagram way - either you're showing comments, or, if # symbol was detected, displaying a list of users. So almost all your UITableView's delegate and data source methods will start with something like if (isMentionMode) and you'll choose specific cell class/cell's height/amount of rows per section/etc depends on isMentionMode state.

Working with storyboards in Xcode, how to handle massive Storyboard in iOS

I have been using the storyboard to make an application and currently there are many segues and several components. This is causing a ton of lag when I try to do anything inside the storyboard. Is there a way to hide components inside the storyboard? thanks.
+1, For the potentially features to improve Xcode. Now, there is no way you can hide those views (Not that I know). But I would suggest you to,
Hide the debug areas you don't need.
Hide the document outline while working with segues.
Why?
I think in this way whenever you are making changes, system does not have to repaint those unwanted views and long document outline. Probably this will be less laggy(I don't think there is a word like this)!
Work around
Divide your segue into different meta segues and then you can call those segues from your main segue. In that way you don't have to put each connection on one file but you condense it!
And here we go the documentation for it! Now you can get the story board by different file and then initiate with the UIViewController easily. Then you can just use old ways to segue between different ViewControllers.
Apple Documentation for UIStoryboard
Demo App.
In order to achieve this, I have made a quick demo application which will help any future visitors.
https://github.com/Krutarth/LargeStoryboardManagement
Visually something like this,
You can split one huge storyboard into multiple small storyboards.
Select the view controllers that you want to move to a smaller storyboard, then
In the top menu, click Editor -> Refactor to Storyboard
Save the new storyboard with the desired name. XCode will auto generate all the required storyboard links from your large storyboard to this newly created small one.

XCode 4. Keyboard doesn't hide on iPad

I have a problem with my iPad app.
I perform authorization in social networks (facebook, twitter etc.) to post information from app. Several webviews change each other (login, content of post, captcha). They have text fields and I have to show keyboard. After posting I return to some start view with posted information.
It works good, but after posting first news something goes wrong. When I post news one more time, after return keyboard is still on the screen.
I saw here some questions familiar to this, but they wasn't useful.
I tried to make resignFirstRersponder to all webViews, textFields and textViews. Also i\I tried to implement method disablesAutomaticKeyboardDismissal but it doesn't help me.
I don't know where search for problem...
So questions are: why could this happened? How can I solve this? fnd How can I get some information about keyboard? (is it visible, what object has focus etc., anything that could be useful to solve problem)
And one more thing. I have similar app for iPhone and it seems to work correct.
Try this:
[searchBar performSelector:#selector(resignFirstResponder) withObject:nil afterDelay:0.1];
Make sure to replace searchBar with the object that is the actual First responder in your case
Problem is fixed, finally. The reason was the way I had changed visible view. I set a new value to view property of ViewController. And as previous view contains text field with focus on it, focus wasn't lost before changing view (and keyboard was still on the screen), but I had lost handler to previous view.
Solution is: resignFirstResponder to all (or current) inputs BEFORE changing view.
Hope, it's clear. Thanks for your help!

Is assigning the same Action-method to multiple Cocoa UI objects e.g. NSButton possible?

I'm currently learning ObjC and Cocoa programming, coming from the Java world.
To test my current skills and learning progress I'm creating a small calculator app from scratch (OSX not iOS).
My UI has 10 digit buttons 0-9 among others.
My first thought was, since the action receives the senders reference, to make one action
like -(IBAction)captureDigit:(id)sender and then just grab the digit from the button title.
But the interface builder only allows an action to be connected with one sender it seems.
So I ended up creating 10 captureDigit actions in my controller.
My Question:
is the first option possible somehow? I thought of adding the actions programmatically (is this possible?) to the buttons, but then I would have to add all digit buttons as outlets to my controller.
Bonus Question:
can a NSButton hold some kind of non visible value? Could not find this in the documentation.
Maybe this would violate the MVC pattern as the UI would then know of application specific data?
Thanks for any useful and kind answer in advance, I'm still learning
You can connect many senders to one target/action if you Control-drag from senders to the target, so that's not a problem.
WRT your bonus question, any NSView has an integer tag which you can set in Interface Builder. That's a convenient way to differentiate multiple similar views.
You can definitely connect more than more button to a single action. Also, you can use the tag field of any object to give it a "behind the scenes" value.
It's perfectly possible to add as many actions to a single controller. How is Interface Builder preventing you from doing this?
You could have a NSDictionary instance in your controller, in which you could match NSButtons to whatever data you want.
To make it easy, in IB create one button and drag from NSButton to File's owner it then shows all of the methods that we can send to NSButton, then select captureDigit:. Now copy and paste the button change the title, copy and paste in IB keeps the connection and use tag field as costique, nitrex have already said.

how to add custom keyboard

I did a simple application.
My application contains 10 Text fields.
what i need is i need to hide default keypad i place manual keys like this
How can i done this keys works as a keypad to my app.
can any one pls post some code or link.
Thank u in advance.
I wrote a KeyPad, that is easy to customize via its delegate.
Just add a view with 10 buttons and assign action for each of them.
In the didBeginEditing method diss the keyboard using,
[textField resignFirstResponder]
[yourKeyboard show];
And i think apple will reject the applications using custom keyboard
There is a complete thread about that here
It has a tutorial, lots of comments, sample code and project, everything you need is there. (Is quite long though)
You basically create a view with your buttons for example and
In iOS3.2 and above you can use inputView property of your textField.
In early iOS versions you have to do a trick (add your keyboard as a subview of UIKeyboard) that is also written in the link.
If you need more advanced stuff than simple numbers, you probably want to look at UIKeyInput and UITextInput protocols.
Hope it helps