I am working on project where I have to add a dialog box on the click of tool bar button in such a manner when user click on the that a dialog box open with three buttons.
For Example if user click on share button then a dialog box open (pointing to that button) containing three buttons facebook, twitter, email.
Please be sure that I dnt want to use action sheet.
Please provide any sample code or any tutorial.
You could create a viewcontroller object with three desired buttons on its view. And then On the viewcontroller where you're currently on you can call presentModalViewController:animated method. Like:
MyModalViewController *modalController=[[MyModalViewController alloc]init];
....... then whereever you touch up the tool bar button you can say:
[self presentModalViewController:modalController animated:YES];
But you should not forget to call dismissModalViewControllerAnimated at some point(probably write this inside a button touchupinside target action method) on the dialog box to avoid having the modal view stuck on the screen forever. :)
Related
Hi I am using SWRevealViewController library for sliding menu in my iphone app and already I have implemented it, but there's a problem, after the menu appears and user click on the front view the menu doesn't toggle like in facebook !
Scenario:
-User pressed or swipped on the front view.
-the menu appears.
-when user click on the front view again the menu doesn't disappear it still and that's strange!
How can I make the view toggle again, Thank you
I have a Tabbed Application which has six tabs, so as expected two of the tabs move under the "More" tab at the end. I have a refresh button I want to put in the top left corner of every tab view, but when I place these using the Storyboard, the back button with the "More" text is overwritten if I'm in one of the tabs that was moved under the More tab. The behaviour I'm trying to get is to put the refresh button NEXT to the More tab, kind of like how Apple did their tabs in the iTunes app in the attached screenshot.
I've tried looking at methods that do button placement using code but most of them seem to assume you want to create all the buttons using code and place them in an array. I haven't been able to find a way to create the More button, since I think that's generated automatically, but if there's a method I could use to add an extra button alongside it, that would do what I'm wanting.
tl;dr: Is there a way to add buttons alongside the More button?
(I'm new so I can't add screenshots, but here is a link to the screenshot I meant. http://i.stack.imgur.com/GV6M2.png)
Will you know what the index of the "More" button will be, so you could add your "Refresh" button to the button array just before it?
Found the answer! It always helps to look at the list of methods. There's a BOOL you can set called leftItemsSupplementBackButton and it is normally set to NO, but if it's set to YES it will add any buttons next to the back button instead of replacing it. Even works with Storyboard-created buttons :D
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UINavigationItem_Class/Reference/UINavigationItem.html%23//apple_ref/occ/instp/UINavigationItem/leftItemsSupplementBackButton
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self performSelector:#selector(loadLoginScreen) withObject:nil];
isAnimated = YES;
[self.navigationItem setLeftItemsSupplementBackButton:YES];
}
I want to implement this on my app. I want to search for tutorials on this topic but I don't know what its called. Can someone please tell me what its called? Eg. In the photos app in iPhone, when u click on the left most button at the bottom, a screen pops up from the bottom giving you options to either email image, set as wallpaper etc.. So, once again, what is this called? Thanks
That is a UIActionSheet. Check out the UIActionSheet Class Reference.
Basically you create one with the designated initializer -initWithTitle:delegate:cancelButtonTitle:destructiveButtonTitle:otherButtonTitles: then send the -showInView: message to display it. You'll have to set yourself as it's delegate in order to handle selections made by the user.
The button is the 'action' barButtonItem type.
The button then opens a modal sheet. Opened with something like:
[self presentModalViewController:menuViewController animated:YES];
I have a navigation bar in my app. The below pictures are in the order of navigation.
Problem I have is, on clicking the "Main" button , I am able to perform the action and goto the required screen , but the navigation bar does not look like the first on (with Menu as left button). Instead it look like 4th image. How to make it look like first image so that I can make the user to navigate to "Menu" screen by clicking menu button ?. Thanks for the help …!!!
If I'm understanding this correctly, you may have pushed the first view controller (The one from screenshot 1) when clicking on main which is why you see "lens" in the back button. That back button takes the title of the previous view controller in the stack. What you want to do is pop to the first view controller when they click on Main using either popToRootViewController or popToViewController:animated
want to click a button through javascript for testing purpose. i am able to click the button which is on first page, but dont have idea how to click button on second page which comes after clicking button on first page.
You just need a reference to that button on the second page -- so you repeat the process from the first page. Probably, you did something like this (this code is from my app using a tab bar controller):
// Now tap the add button
var navBar = mainWindow.navigationBar();
navBar.buttons()["Add"].tap();
// Now the app loads a new page
// Get the nav bar again (it would have changed after the tap above)
navBar = mainWindow.navigationBar();
So, the answer is easy -- just call back to the same functions, they will return whatever's on screen at the moment.
First you have to ensure that the button is accessable. Either set the Accessability property in Interface Builder (Identity Inspector - last Tab) and give the button an appropriate Accessability Label. If you don't use Interface Builder you can set the property on the button programaticaly.
Now in the script you can call
mainWindow.buttons()["name of the accessability label"].tap();
mainwindow is:
var target = UIATarget.localTarget();
var application = target.frontMostApp();
var mainWindow = application.mainWindow();
Make also sure that the button is visible. The button has to be the deepest element in the view hierarchie which is marked accessable. If the view containing the button is enabled as accessable, it would hide the accessability of the button (which is a subview).
You can log all visible elements in the screen by
mainwindow.logElementTree();
Moreover, you always can use one single script. The mainWindow.elements() references the view which is shown at a certain moment.