How to launch UIViewController that is embedded in UINavigationController - ios5

I have TabController with 2 tabs A &B
Tab A: UINavigationController1-->Controller X--->Controller Y
TAB B: UINaviagtionController2-->Controller A --->Controller B --->Controller C
In the Tab Controller, I have a button that I would like to launch Controller X.
How do I get X with its navigationBbarController? I can get to X, but doesn't show the navigation?
Thanks

Related

Is there a way to resize a UIButton in Xcode?

How do I get the 0 width to be equal size with 1 and 2
( . ) to be equal width as 3 and = to be equal width with +?
I can't drag the white square (When clicking the UI button) to resize them.
Screenshot of my storyboard:
Follow Steps
Focus on stack view contain the elements "0 . ="
select ". =" element and embed into a stack view
StackView properties must be "Alignment = Fill", "Distribution = Fill Equally" and "Spacing" as per other elements
Option1
Set the StackView to Distribution Fill and then control drag the 0 Button onto the . Button. Select Equal Widths and then set the Multiplier (times 2 since it should be twice the size) in the Size Inspector.
Option2
Put the .Button and the = Button in an equally filled StackView and then the 0 Button and the StackView in another equally filled StackView. This is probably the better option if it's a 50-50 distribution.

Set tag to button via prepareForSegue

I have a tableViewthat passes data with prepareForSegueto a new ViewController when pressed. In that ViewController I have a button that I want to use the tag function on.
Is it possible to set tagvia prepareForSegue?
If row 1 in table view is pressed, destination.button.tag == 1and if row 2 is pressed destination.button.tag == 2 and so on

How to expand UIView and move other components when expanded

I have a view Controller that contains filter_View
and a tableView_Players
.
When I press the button "Filter la recherche"
I want the Filter_View to expand this way
and results moving the tableview down
.
How to do that ? thanks in advance :)
If you are using AutoLayout, do following :
1) set vertical spacing from tableView to filterView.
2) set Height Constraint of filterView and set its outlet.
3) Initially that height constraint e.g. heightOfFilterview.constant = x
4) While clicking filter la button set heightOfFilterView.constant = y (Whatever you want).

iPhone app simple calculator - objective c error

i'm new in iOS developing and the objective c. so i want to start with a simple app.
i'm trying to make an app for a play cards game that records the score each round. so it just adds up each team (two teams ) score. in the app interface there will be three buttons and two text fields to add the scores and a text view to see all the scores recorded.
so now i'm on the record method n i get a runtime error after pressing record in the iPhone simulator :
- (IBAction)record:(id)sender {
// NSString *slna = lna.text;
// NSString *slhm = lhm.text;
int x, y, resultx, resulty;
x = [lna.text integerValue];
y = [lhm.text integerValue];
resultx = 0;
resulty = 0;
resultx= resultx+x;
resulty= resulty+y;
alnashrah.text = [NSString stringWithFormat:#"%d %d", resultx,resulty];
the error message i get : " Thread 1 : breakpoint 2.1 "
IF that is all the information the console is telling us, this is not an error message, it means you added a breakpoint. Beside your code, you will see a gutter line, if you press it you can add breakpoints which are these blue arrow things. Here is an image:
So to unselect the breakpoint, just click it or right click it and press delete.
Also to disable breakpoints: command+Y or press the breakpoints select button at the top near the stop button and the scheme bar and the build status bar

Navigation Controller and Title for the previous screen in Navigation?

So if I am on a screen I can navigate to the next navigation screen using the pushViewController and I simply get to the next screen, with a backButton to the previous screen.
Does the previous screen , (the screen which the back button pushes us to) ... does it have a name ? (Like previousViewController os something like that ) ??
My goal behind this question:
If I have 5 screens (1, 2, 3, 4, 5 respectively)... lets say I navigate from 1 -> 3, and in another case I navigate from 2 -> 3. I want to say that if the "PreviousViewController was 1" then navigate from 3 to 4 (1 -> 3 -> 4), else if the previousViewController was 2, I want to navigate to 3 to 5 (2 -> 3 -> 5)...
How do I accomplish something like that ?
Thanks !
p.s.
I know I could also try something sensible and logical with another approach and just pushViewController accordingly. But if there is a solution for checking the previousViewController, it would make my task easy and would be a great learning experience.
You can actually do that by using the viewControllers property of UINavigationController. This is what Apple says about it:
The root view controller is at index 0 in the array, the back view controller is at index n-2, and the top controller is at index n-1, where n is the number of items in the array.
Your "previous controller" is what Apple defines "back view controller", corresponding to index n-2:
NSUInteger arraySize = [navController.viewControllers count];
UIViewController* prevController = [navController.viewControllers objectAtIndex:count-2];
Nope, there is no previousViewController. UINavigationController is implemented as a stack so you keep pushing view controllers and those can pop themselves off the stack.
FYI, if you're trying to view all the stack of viewcontrollers then UINavigationController has property called "viewControllers" which is implemented as NSArray.