How to make a custom Swift popup window on iPhone - swift

I'm wanting to implement a custom popup window within an iPhone app that contains buttons and labels.
One solution I've found is to simply create a hidden UIView in the same View Controller (How to make a popup window with an image SWIFT) and then making hidden = false. I feel like this shouldn't be the "best" way to do this, just due to the way I'll be working with multiple interfaces in the same View Controller.
Another method is forcing a non-fullscreen popover on iPhone (http://richardallen.me/2014/11/28/popovers.html), but this doesn't seem to play well with containing other elements like buttons and labels.
Is it possible to create a custom popup window for iPhone - which can hold buttons and labels - that can be implemented from a separate View Controller in my Storyboard? It has to be in a way that doesn't hide my main UI behind a fullscreen popover. Preferably one that can be easily animated using UIView.animateWithDuration.
Just looking for some starting directions so I can go learn more about implementing it. Or is stacking it with my other UI in the main View Controller the best way to go?

add a UIView container and make it's alpha = 0. If you want to show it you can increase the alpha to 1. And simply add a exit button to your container to decrease the alpha to 0.

Related

Forcing a UIImageView to Remain in Front of an Active Animation

Language: Swift, IDE: Xcode for iOS development, Single View Application > View Controller...
I have 2 UIImage Views with identical images that I'm scroll-animating from left to right across the view in order to create a 'slowly-moving background' of sorts. I'd like to place other UI elements (Labels, other images, etc.) in the foreground of this repeating background animation, but find when I run the simulator the foreground image isn't seen...
Question: Is it possible to force other UI elements to stay in front of a repeating animation programmatically?
I'm not at my Mac so I can't share my code at the moment, but if you know a straight answer to the question and/or which method could best achieve this, I'm all ears!!
Thanks in advance! :)
This depends on the z-ordering of the views. Assuming you are adding all of your views then starting the animation call bringSubViewToFront on the view you are animating right before you start animating it. If you are laying things out in interface builder the Z order is based on top = farthest and bottom = closest. If you are adding view programmatically the newest view is always added in front. You can change this with insertSubview:at: and the related methods. Take a look at the documentation for UIView.
If you want z-index use:
YourImageViewName.layer.zPosition = 1
Also you could play with bringToFront method on the parent view:
self.view.bringSubviewToFront(YourImageViewName)
Hope this fix your problem.

Element on IOS Programming

Im kinda new to Stack Overflow so bear with me please. I am trying to design an iPhone app and I noticed a feature on Huffington Post app that I have been trying to replicate with a different style. I am confused on whether they are loading this as a html inside a webview, or if they are reproducing this programmatically on XCode.
I have looked at UI Picker and UI PopOverController and neither can replicate into that. Can someone give me some advise on what element I have to use in XCode?
Here are some attached screenshots
Based on what your screen shot looks like, here is my guess of what they did:
On the view which they bring up the "popover", they have a UITableView with custom UITableViewCell. At the right end of the UITableViewCell(the image with plus sign) is a button, and based on the position of the button, they can decide the position of the popover and direction of the arrow.
They used a custom popover control. Inside the popover, there is a UITableView take all the space.
If you wanna do the same thing, you will have to know
How to use custom UITableViewCell.
How to do popover on iPhone.
Delegation if you wanna the view underneath to react to what you click inside your popover.
I can provide more details if you need.

Can my custom tabbar be created like so for iPhone?

I have designed a custom tabbar and the developer says the design I created can't be done.
The screen is made up of a usual background with a tabbar. I'd like my tabbar to look a little different to the usual iPhone style. I would like at the bottom of the tabbar a grass illustration (transparent) and on top would sit all the separate buttons and on top of those would be the icons. All of these images (as seen in link below) are separate .png files.
When the user scrolls the content, it will scroll under the transparent grass. The buttons of course will be clickable and have a different view for an active state.
Please see the link below to see a mock-up of the image:
http://www.stuartkidd.com/dummy.jpg
I'd appreciate if the community could explain to me if this could be done and if so, how. I thought it would have something to do with 'creating a custom tabbar'.
And a further question, if it can be done, can also the tab buttons be horizontally
scrollable with a swipe action?
Thanks,
It all can be done but you are going against the Iphone UI guidelines. You won't be able to leverage the UITabbarView to do what you want so you'll basically have to write the whole thing from scratch. Your tab bar would be a scroll view with a row of buttons representing each tab. When a button is clicked you load in the appropriate view. The UITabBar controller gives you a lot of functionality for free and I suspect once you start working towards this you'll see exactly how much extra work this will end up costing you. Going against the way Apple does things can be a slippery slope.
Another idea might be to keep a hidden UITabBar to manage the tabs and call it from your custom tab bar. This would free you from a lot of the hassle of swapping views/controllers in and out.
You can create a row of custom buttons and have 2 subviews. One for the bottom navigation bar and one for the content view where you will be swapping your content based on what is pressed.
You can have a state which maintains what was clicked. Based on that you can set the button enabled state for every button in your bottom bar.
button.selected = YES
It will be easy to handle the touch up inside events and properly load appropriate views in and out of the bigger subview as they will be part of the same view controller.
I have implemented a similar functionality and it works well but still in process of submitting it to the app-store.

How to realize the same effect like iPhone's homescreen

I want to add some custom buttons and realize the same effect like the iPhone's home screen. What I can think of is to calculate the position of each button and add them to the view. Are there any other ways to do this? e.g. add buttons to the tableview
Check TTLauncherView from Three20,
I realized the same view of the thumbnails in the photo app (which in principle differs only because of the background color and the rounded effect of the buttons) using a custom cell (with 4 UIButtons inside) in a normal tableview.
In my case, this is because I need to scroll up and down, in your specific case there should be a way to "lock" the table from scrolling. By the way, for this reason, it could be simpler to design the custom view in the interface builder, it is very quick to design such a view, and then create a custom controller to provide simple methods to assign icons and actions to the UIButtons dynamically.
You could also look at the Three20 libraries as already suggested, it is already implemented, but you app will easily be rejected by Apple if you do so.

Customized Camera Toolbar on iPhone

I've created a camera application for iPhone and now I sit and polish the last of it. My application is a collage application where the user can take multiple pictures in a row.
As it is today I have a customized camera view that contains one UIButton for taking the pictures and one UIButton for getting back to the main view.
The problem is that my application is design for landscape mode and the camera control can only show in portrait mode. This makes the design of the GUI a little bit tricky and I now want to move away from having the buttons in the view to having the placed in a toolbar. When you initialize the camera you can set a bunch of different parameters and one of them is UIImagePickerController.toolbarHidden. If I set the value to NO it will show an empty toolbar and my question here is, how do I add items to this toolbar?
I've tried different solutions without any luck.
Thanks,
drisse
Does the standard UIViewController method -setToolBarItems:animated: method not work?