I'm working on a Dialog for my iOS app, and have decided that the default boxes don't allow for the level of customization I am looking for.
So, I have created a view inside a storyboard. It is embedded in a view called DialogBoxView inside DialogLayout.storyboard with a view controller called DialogLayoutViewController.
In short, I want to be able to open the specific view as a Dialog. (Like this below.)
But, as previously mentioned, I want the View inside the Storyboard to inflate as the dialog's layout.
What I need is a way to call into the ViewController handling the Storyboard [I can do this] and open the specific DialogBoxView inside.
See:
My Hierarchy
See:
My Layout
Please note that I have browsed around a bit on Google, and nothing is useful. It is either outdated (OBJ-C) or not what I really need.
Additionally, is it possible just to (like in Android/Java) "inflate" the View layout as the Dialog's view?
Summary:
Can anyone give me an example on how to inflate a specific view (inside a Storyboard) as the dialog programmatically from the ViewController?
I'm still kinda new to Swift and iOS development in general, and I have come across some functions that may work, I just can't put them together in a way that actually works.
NOTE: I have found a way around custom layouts, but am still curious as to how this might work.
Swift 5
Some time ago, I created one project similar: You can see in: https://github.com/MaatheusGois/custom-alert
Related
Okay so I know that you can embed a ViewController inside a view. But the situation I have is a little different
I have an app which is using an external monitor. When the monitor is connected, I'd like to display the ExternalMonitor ViewController inside another view on my iPad screen. Like a Live Preview. I can't work out how to get it to display the ViewController on both my ExternalMonitor and my PreviewView at the same time.
Basically:
1 ViewController displayed in 2 places at the same time, scaled to fit the two different views.
Is this possible. Can someone point me in the right direction?
I apologise if my terminology isn't right. I am quite new to Xcode and swift.
While someone might offer a better solution to this, you might try displaying 2 instances of the same view controller class in 2 different places. It won't work of course, if this controller should respond to user actions. They will not be in sync that way.
You can use a common UIView in multiple view controllers for e.g we do use in making common headers and footers , but according to my point of view this is not possible to use 2 instances of a view controller at the same time . It will got clashed , may be it will work sequencely one after another but not on same time.
I am working on a project and with the hopes of developing my skills and providing open source package in iOS. I came across a unique interface that really got my attention which comes from a great app and there are two main things I would want to work on.
Pull to add and release to add.
This feature I know was built with a table view but how it was implemented remains unknown to me
Side navigation which contains time selection. The time overlays the tableview in this part
I would be glad if anyone could gimmie tips on how to go about this things or open source libraries that one can reference.
The application is Sorted you can check it out on the App Store
Look up on the following topics,
UIPanGestureRecognizer (this is to recognize the pull down)
CGAffineTransform (to rotate the text field)
Movement/Transformation of the elements could be done by changing the constraint values and calling UIView's layoutIfNeeded inside an UIView animation block
You can make the keyboard appear by making the text field first responder
If you are interested in building rest of the features 'Sorted' has. They you may check https://cocoapods.org/pods/FoldingCell for some inspiration :)
I am working on an e-commerce based app, and the designer has passed on the mockup to me. !
This is the mockup the designer has passed.
I am working on storyboard of this mockup and I have managed to get to this level as of now.
There are several views and features which cannot be included in this storyboard now because of the limited space. I know the designer has passed on me the rendered view, which can be seen on scrolling the app.
I wonder which could be the best approach to include all these views in a single storyboard or render them in a single view.
I have looked onto using xib files and calling them from my viewcontroller class, which could be a possible solution. But, I want to know, what could be the best solution?
Best solution is use Storyboard so that you have all screens at one place. But keep one thing in mind that start doing the whole project in XCODE 8 storyboard (Because XCODE 7 and 8 storyboards are not fully compatible with each other). So that you get compatibility with previous iOS versions also (< iOS 10)
Now as far as design is concerned, I would like to suggest you use autolayouts and proportional layout.
your View controller will always have self.view. Start on that view. First add navigation controller (with root view controller as your first prefered view controller on app start) or simply add one toolbar. Then add one UIScrollView to whole remaining space. Then start with your design inside UIScrollView. Don't forget to provide contentSize of UIScrollView.
For any help, feel free to ask.
The best solution would be using a tableView with multiple prototype cells for this kind of problem. Well, going through the concept as mentioned, I could easily scroll in the storyboard and maintain my design as per the mockup.
So far I came across many developers are using Custom view controllers instead of .xib file often. Can anyone tell me that which one is the best way? using custom or static?
It's your wish, use what ever you feel is easy for you. I prefer custom , because it gives me much more freedom to play with my custom views. Yes it is much more laborious , but you have more control over it(what i personally feel).
It would be great if you elaborate your question...
here is a small example where i used custom. The data to create views (like textfields , buttons etc) was being provided to me in form of XML (from server). So this XML can be changed any time at server end. which means if my view is rendering 3 textfields today, on changing xml it shows 10 textfields. So if your view is not static or fixed, you should use custom method.
In IN SHORT - fixed or static view -use xib (you can use custom also). in case of dynamic,you can (should) do it programmatically.
if you are designing UI with code (not using Xib/Stotyboard) this will be good when you create UI dynamically so then you need not to spend more time on changes. what ever we use for development (Code/Xib/Storyboard) nothing will be changed in performance. As per user/developer comfort we will go for it. Suppose there are lot of UI need to be displayed few at the time viewdidload and rest after some button action then usually at the initially stage itself Xib and Story board will load all of them and hides un wanted and as per actions it will show the hidden UI. i feel coding is better for me.
I have noticed the UI Component in XCode: Container View.
Based on the description provided I would like to make use of it to display a reusable component of my app in several different screens. I have been looking around online to try and find a basic tutorial or some documentation on it, however I havent found anything of use.
Please could someone advise on how to wire this up and make use of it? At the moment it also appears that the container view doesn't seem to resize which is problematic. Any tips on how to enable this would be appreciated too.
Cheers.
Well let's break this into some simple steps:
Drag a container view to the main view of one of your controllers. When you drag the container view, IB will create an embed segue for you and you can resize the container's view by dragging the resize control points as usual. Any changes in the size will be automatically reflected to the view that the segue is pointing to. The idea is that this view will be managed by a different controller, the embedded one.
Set your custom subclass as the class of the embedded controller.
Now you're good to go. Note that any containers you add will be available through the childViewControllers property on your main controller.
This is obviously an oversimplified workflow but it's enough to get you started. For more information on the subject, see Apple's documentation here.