Tabbarcontroller,NavigationController and viewController - ios4

I have made a Tabbar based application in that i have three tab.
each of tab has NavigationController..
In one of the tab (lets take in the 1st tab), i have a UIButton in that FirstViewController that is rootViewController of NavigationController..by clicking on button i navigate to the secondViewController...
Now i switch to second tab. and again switching back to 1st tab i got secondViewController open.
but i don't want that....i want to go on the FirstViewController while switching back to 1st tab...
is it possible ???
if yes then can any1 help me to solve it out??
any Help will be appreciated...

That is the default behavior of UITabbar controller,so that the user can go back to the view controller which he had left from earlier.You cannot change it.

Related

Cocos2D, UIScrollView and CCMenu

I use an UIScrollView to set the position of a CCLayer (when i drag with the finger). It work fine but in this CCLayer i've got a CCMenu with one button CCMenuItemImage.
When i click on this button it's ok. But if i press the button and drag just a little bit the layer, the button stay pressed and become not responsive.
thanks for your help
The UIScrollView interferes with the touch events received by CCMenu. It was never designed to share its touches with a UIView.
You have these options:
find and fix the issue by modifying the CCMenu class
write your own menu class
don't use UIScrollView or disable its touch input while the menu is active
I think you'll need to modify CCMenu and attempt to disable the scroll view's ability to scroll on touch. Have a look at the UIScrollView properties called scrollEnabled and delayContentTouches.
By the time the CCMenuItem callback has been called, it might already be too late.

A keyboard with a UITextField

I have a table listing some strings, and what I want is when I tap the add button on the navigation bar, a keyboard with a textField would jump up, so I can input a string in the textField, then when I tap the return key, the keyboard disappear as well as the textField, and the new string is added to the table.
I already make up a nib file with a toolBar containing a textField, and I just failed to go on.
How can I implement this idea? Use the inputAccessoryView? If so, that means the inputAccessoryView of the textField which belongs to the toolBar is gonna be the toolBar itself!
This seem kind of weird and I have not been able to make it work till now.
Or is there another way for this idea?
Thanks a lot!
I've solved the problems by using notification instead of inputAccessoryView.
There is a sample code in XCode called "KeyboardAccessory", and it gives a good example about using keyboard notifications!
Or custom a view with a tab, and set it as the textField's inputAccessoryView, that would also work!

UIBarButton differences between View and tableViewControllers?

I have a tab bar iPhone application.
Tab bar #1 has a table view controller. It pushes a detail screen onto the stack.
On the top right hand corner there is a UIBarButton that calls and action sheet. This
is all built programmatically through code and all works fine.
Tab bar #2 calls a table view controller than then loads a map view. The map view annotation callouts then open up a detail screen. On this screen, I'd like a UIBarButton. So far, I cannot get this to work. The button does not show up.
Any ideas why?
Thanks,
J
UIBarButtonItem is not inherited from UIView.so u can't.
why dont u just use UIButton with Custom picture .
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIBarButtonItem_Class/Reference/Reference.html

Change "back" NavigationItem text in Monotouch?

Is it possible to change the "Back" button text in a NavigationItem? At present, the caption of the back button assumes the title of the previous layer in the navigation stack, which is expected.
However, the NavigationItem's LeftBarButtonItem can be changed using code such as this:
UIBarButtonItem backButton = new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain, null);
myNewView.NavigationItem.SetLeftBarButtonItem(backButton, true);
This works and the back button is displayed as expected, but the button is a square and does not navigate back to the previous layer as expected. I'm guessing that the correct event needs to be assigned to it, but I have no idea what it should be.
How would one go about ensuring that the new UIBarButtonItem has the correct event and arrow shape?
Note: I have also tried re-using the `LeftBarButtonItem' as suggested in this SO question, but I still don't know how to customize the button caption. I am probably just missing the obvious.
Thanks!
Set the title on the previous viewcontrollers navigationitem. I answered this before and will look up the link.
Ah, yes: Separate title in NavigationBar and navigation buttons

inputAccessoryView not hide the view when -resignFirstResponder?

I have attached a toolbar with a UITextField and UIButton to the keyboard when it becomes the first responder via the user taping inside the textfield
textField.inputAccessoryView = theToolbar;
Problem is, the toolbar disappears when the keyboard is dismissed, thus preventing any further input.
Any ideas on how to make the toolbar go back to the bottom of the screen rather than off it completely?
I'm thinking a delegate method might help but Im really not too sure. It seems once the inputAccessoryView always the inputAccessoryView :(
Cheers
The input accessory view is automatically dismissed with the input view (the keyboard, in this case). Generally you do not want to have an input accessory view in your view hierarchy. Instead, if you want your toolbar to scroll up when the keyboard is shown, you should follow the guidelines for Managing the Keyboard.
You could try using an additional toolbar that is offscreen as the inputAccessoryView, which could "fake" the appearance of what you are trying to do. Alternatively, have you tried adding the toolbar back to the bottom of the screen using
[self.view addSubview:theToolbar];
when the keyboard reaches the bottom of the screen? You can use keyboard notifications for this.

Resources