Navigate between UIViewControllers and UISplitViewController [closed] - uisplitviewcontroller

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have two UIViewControllers and a UISplitViewController. I am adding UISplitViewController as root on 2nd UIViewController. Here is my code:
[splitViewController setViewControllers:[NSArray arrayWithObjects:rootNav, detailNavigate, nil]];
[splitViewController setDelegate:detail];
self.view.window.rootViewController=splitViewController;
With this code UISplitViewController gets added as root.Now from BACK button on SplitViewController. How to pop to Previous UIViewController? If I use this code, then NavigationBarButton on UIViewController does not work.
[self.navigationController presentViewController:backToView animated:YES completion:nil];
How can i navigate to and from UIViewControllers ?

IMO, you should set UINavigationController as a window's rootviewcontroller and push splitivewcontroller on it.
e.g.,
[splitViewController setViewControllers:[NSArray arrayWithObjects:rootNav, detailNaviagate, nil]];
[splitViewController setDelegate:detail];
//self.view.window.rootViewController=splitViewController;
self.navController = [[UINavigationController alloc] initWithRootViewController:splitViewController];
self.window.rootViewController = self.navController; // make root a navigation controller
Now, if you push another view controller on the navigation stack, your back button should work.

Related

How can I show a loading screen while calling multiple APIs at once? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I am using Angular version 8 to write an application that gives back to users a number of responses from different APIs.
The application is calling multiple APIs at once to get responses. I need a loading symbol that will stop for each of them once they get the response.
They all vary in time from few seconds to a minute.
How can I implements something like this?
Check this example I made on stackblitz: link
what I did is I setup an angular material spinner and a tag where I can put my API results, in my temple:
<button (click)="onFetch()" >Click me to send request</button>
<mat-spinner *ngIf="spin"></mat-spinner>
<p *ngIf="!spin">{{result}}</p>
the button is there just to fire the request to the API.
as you can see in the template I set up an ngIf on my spinner and on my result tag, to either show the spinner or the result.
after that I make a request by clicking the button, as soon as the button is clicked, onFetch function is executed which make the spinner visible because of this.spin = true.
onFetch() {
this.spin = true
ajax.getJSON(this.url)
.pipe(
delay(1000)
)
.subscribe(json => {
this.spin = false
this.result = json.value
})
}
as soon as the request returns a result, this.spin = false is executed and the spinner is not visible anymore.

Right click on linkbutton and select "open in new window" opening blank page [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have link button. Onclick event of this button, i am filling a session value and redirecting to other page. But my problem is, while right clicking on that button and selecting "open in new window" option, page is redirecting to blank page.
Any help would be appreciated.
Thanks.
Your onclick event won't fire when you open a new tab, or middle click on it.
You can take care of it manually, however, like this:
$(document).on("mousedown", "a", function(e) {
if( e.which === 3 || e.which === 2) { // 3 = right click, 2 = middle click
e.preventDefault();
// do your thing
}
});
Fiddle Demo

Linking Storyboards Without UINavigationController

I have an iOS 6 app that I am updating to work with iOS 7 and to make it use storyboards. I am trying to use multiple storyboards so that I can break my project down into modules for each screen in the app. So far this has worked out fine but now I need to provide a way to navigate between the various storyboards while still making the work like it did in iOS 6 (but with updated artwork).
I don't use UINavigationController in my existing iOS 6 app and I would prefer not to use it as up to now I have been able to navigate back and forth between XIB's using code on UIButton tap gestures. The UINavigationController doesn't make it easy to customise how the navigation buttons look from what I have learned so far about it.
I found this very clean way of moving between view controllers that are on different storyboards https://github.com/rob-brown/RBStoryboardLink by passing the name of the storyboard in as an attribute.
But it only seems to work when UINavigationController is used. I get an error "Push segues can only be used when the source controller is managed by an instance of UINavigationController" without UINavigationController.
Is there a way to navigate between storyboards by only using the above RBStoryboardlink but without the need for UINavigationController?
Push segues can only be used when the source controller is managed by an instance of UINavigationController
This means you are trying to push a view controller to the source while source don't have any navigation controller stack.In that case, you should try to add the instantiated view controller's view as subview to the source view controller's view.
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
UIViewController *viewController = [mainStoryboard instantiateInitialViewController];
[self.view addSubview:viewController.view];
or you modally present, that purely depends on your requirement.
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
UIViewController *viewController = [mainStoryboard instantiateInitialViewController];
tabBarViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:tabBarViewController animated:NO completion:NULL];

How do I create a home button in the top right hand side of my UINavigationController

How do I create a home button in the top right hand side of my UINavigationControl. Please note that I have instantiated my UINavigationControl on my second UIviewController named: ViewControllerSecond. I want to be able to have the tradition "Home" icon, and when pressed to resign back to my first UIviewControler within the appDelegate named: ViewController.
I've got this far:
#property (nonatomic, weak) UIBarButtonItem *homeProperty;
UIBarButtonItem *homeButton = [[UIBarButtonItem alloc] initWithTitle:#"Home" style:UIBarButtonItemStylePlain target:self action:#selector(home)];
[self.navigationItem setLeftBarButtonItem:homeButton animated:NO];
But I cant link it with my first ViewController or replace the text with a home button image.
Many thanks
I also need the answer to this question as i couldn't find an answer to this question anywhere else.I would hav voteup'd this question if i had 15 repu :(
btw i want the selected items in my tableview to be posted on a new view controller when the "done" button on my top-right navigational bar gets clicked.I have also reached the same distance as the asker of this question.
Forgive me for posting my words in the answer section to this question as i can't post in comments to that question due to that 50 repu :(
EDIT:I think i found an answer,try this plz
Since you hav action:#selector(home) so your method name will be:
- (IBAction)home:(id)sender {
//statements to execute
}
You don't have to link this method with anything as you have already declared this method as selector while declaring that "home" button.Neglect the open linkage in front of your method.
http://prntscr.com/1tc0q9

Trouble with using popViewController flashing white during transition

I have been struggling with switching between views using the UINavigationalController. I have used this system many times without issue but in my new app it isn't working properly.
Here is the issue:
When i am pushing a new view controller i use the following code:
NewViewController *newVC = [[NewViewController alloc] initWithNib:#"NewView" bundle:nil];
[self.navigationController pushViewController:newVC animated:YES];
[newVC release];
The code I am using to return to the previous view inside of the newVC is:
[self.navigationController popViewControllerAnimated:YES];
I was reading that this could potentially be releasing the self.navigationController itself so I implemented this code:
UINavigationController *nc = [self navigationController];
[nc popViewControllerAnimated:YES];
What results is a smooth transition to the newVC with no white flash, but when returning to the original page the screen flashes white as if it is releasing the newVC before transitioning back to the original page. HOWEVER! When debugging I placed breakpoints on viewWillAppear of the original page and on the dealloc of the newVC and the viewWillAppear + transition with white flash all complete BEFORE the dealloc of the newVC is called.
If anyone could please help shine some light on this I would greatly appreciate it.
Thanks!
~Arash
This is an old post, but for those who may run into this issue in the future, I have solved it by setting the clipsToBounds property of the view of the ViewController to "TRUE"
-(void)viewDidLoad {
[super viewDidLoad];
self.view.clipsToBounds = YES;
}
Try changing the background colors of the various views on the navigation stack to different recognizable colors (including the main window). One of them might be showing for some reason, and if each one has a different color you can determine which one is the culprit pretty easily.
FWIW, this same issue happened for me in a Swift app. The root cause appeared to be that I was doing this:
self.navigationItem.rightBarButtonItem = nil
...to dynamically hide the button, where the UIBarButtonItem had an outlet in the current UIViewController.
I did not actually need an IBOutlet for that button, so I removed the outlet, and it worked.

Resources