I had working with the iPhone example named "MoviePlayer" where it show you how to add an overlay over a MPMoviePlayer.
This works great, but I can't find where did they set the button and label? how can I add some controls of my own?
Asked too soon.
Yet, if someone needs it:
1. open the MainWindow.xib with Interface builder (double-click should work)
2. in the xib window, there is a view named "My overlay view".
this is it.
Related
I am trying to build an app, and I want another view to open up once I click a button. I have searched for an answer, but nothing came up. I already have the button done, but I don't know how to get another view to show up. The view should be another view within the app. I am just a beginner in xCode. Thanks.
I am currently using xCode 9, and swift 4. Thanks.
You can approach this either using the storyboard or programmatically. Using the storyboard, you can ctrl-drag from the button to the other view controller and the segue will be wired up for you, like so:
If you aren't using storyboards at all, you can use the .show method of the ViewController in the button action. Apple has a good guide on segues.
I'm trying to present a popover over a pin I added to a MKMapView. I added a UIViewController to my storyboard, and dragged a segue from the MKMapView in one view controller to the viewController I want to show in my popover and selected popover. I get the error:
Popover segue with no anchor
In IB, I see "Drag to select an anchor", but when I try dragging it anywhere within the first viewController that has the MKMapView in it, nothing gets selected. I'm not sure where to go from here and if popover's from a view that is created dynamically can be used to present a popover with Storyboards. I know I can do it in code, but then I have to copy and paste my setters in prepareForSegue:. Thoughts? Thanks.
You need to make a custom annotation view. This will look like a popover view but it is actually different. A great tutorial on this can be found here: http://www.raywenderlich.com/30001/overlay-images-and-overlay-views-with-mapkit-tutorial
Essentially, you need to go NEW->NEW FILE-> the first option on the top left for OBJECTIVE C CLASS-> Name it whatever you want, I recommend CustomAnnotationView, and make it part of NSObject (rather than the default UIViewController)->follow the instructions on the above listed tutorial. If that tutorial does not work for you then you can search "custom map annotation" and many others will pop up. Apple even has a couple good (though outdated) sample projects which due this, such as a weather app and a callouts app with callouts for three locations in San Francisco.
So, this is kind of hard for me to explain, but i will do my best. I am most likely making a simple mistake, but i cant figure it out. So, im on my mainstoryboard, with a round rect button on the controller. I open the dual view editor and open up the viewcontroller.h file. Now, i should be able to press control and drag the button connection in the .h file, but i cant. It wont give the option to. Does that make sense?
Any ideas?
http://www.youtube.com/watch?v=62Xfn5oAjw0
Edit: For example, i need to do the part at 3:08, but it won't allow me to do that.
Edit 2: Ok. So, i put the button on a single view controller, and everything worked the way it should. BUT, when i put the same button on a tab bar view controller, it doesn't play the sound it should when pressed. The sound played when it wasnt on the tab bar controller just fine though.
EDIT: I watched the video and I know what you're doing. You're trying to create an outlet. When you right click the button there'll be a circle that says "New referencing outlet". Try dragging that circle to the viewcontroller. Otherwise, just type what comes up after he does that manually. Easy.
It should already be connected automatically. You never actually drag the button to the view controller. The view should already be connected and therefore any part of the view is connected. However, if you're having problems in the future, try this to sort of start over.
What you're going to want to do is go up to file>New File
Then you're going to want to select a new view controller, and make sure you tick the box that says "Include a XIB" or something similar.
After that, it will make all the connections you need. Any part of the view will automatically connect to the view controller, and all you'll need to do is create the IB actions to preform things in the interface and connect them to buttons when you're ready.
You have to set the viewcontroller as the file owner of the view. This is done in the story board.
I don't understand why you'd want to ctrl+drag the button to your ViewController.h . If you wanted to link the button to a ViewController in the storyboard, then you just ctrl+drag it to that ViewController. I may not have understood your question, but I think this is what you want.
I'm looking for the simplest code in order to implement a small popup (NOT a full screen modal popup or alert view). I just need it to display some basic text inside the popup, then exit it when I click away. The popup in the EleMints app is a good example.
UIPopoverController does this, but it's limited to iPad only. If you need this on iPhone, just implement a custom UIView subclass. Then when you want to show your popover, instantiate the subclass and add it to your view, maybe with some animation.
You can use WEPopOver as that is the one you required. For more info, visit this link
You can also use the following refrence link for UIPopOver controller
1) WEPopOver Library
2) Popup Bubbles
I've been looking at this new interface for a while now and I can't figure out how to add or remove tabs from the tab bar.
Any help would be appreciated.
There are two possibilities:
1 - Open your xib-file inside Xcode. Show the right sidebar (Navigator | Utility). At the bottom of this bar should be all Interface Builder objects (i.e. UITabBarItem, UILabel, ...). Now drag a UITabBarItem to your View.
If you don't see these objects: At the bottom is a small cube. press it and you'll see it.
2 - Right-click on your file and open in external editor. This opens Interface Builder. If it won't work you can open your file directly with the Interface Builder.
You ask this question in the Apple Developer Forums where you can talk about confidential information (read: NDA software). Xcode4 is not yet available for public consumption, therefore it's still under NDA.
I also work around on find out how to set the tabitem in Xcode4, I found you just drag the controller to the tabitems, the select the uiview of this tab item and set it's class. Xcode on longer support set tab item at the inspect panel.
Assuming that your Tab Bar was created in XCode (which it should be if you created a Tab Bar project) click on your Main Window.xib to view it.
Click the disclosure indicator to see the hierarchy of objects (if it isn't that way already).
It should look something like this:
The number of view controllers that you have underneath it is the number of tabs you have.
In this case the view controller is a Navigation Controller, and the View Controllers are children of it.
If u r using Story board .........
Just do this ...
and i am telling for Xcode 4.3
just add view controller from the libirary you can add as much as you like..
then link those views with your main view controller...
as you will link with it ....
it will automatically pop up relationship with main controller and thus a tap will be added automatically in your main controller...
you can visit this link ....
"http://www.youtube.com/watch?v=qvvJzkJcsew"