Tabs and webView - ios

It will become clear as you read that I have very little experience programming please excuse me for an elementary question. I have on the storyboard the template for a tab based app. which has two view controllers both of which have a web view on them and both seem to be working fine. As I needed a third tab I dragged a view controller onto the storyboard and linked it to the tab bar controller, I also created a "thirdViewContoller.swift" file which was copied from one of the other two which was in the template. Ran the app and everything works fine. I now drag a UiWebView onto the third view controller and unlike the other two when I try to control drag the webView to the code it will not link up. What am I missing. Many thanks for any help.

Did you check that your thirdViewController class is set in the storyboard? Click the yellow circle on your third view controller that you added in the storyboard. Go to the Identity inspector tab. Make sure the "Custom class:" field is set to thirdViewController. Now you should be able to make an IBOutlet for your web view by control dragging.

Related

Use Segmented Control with TabBarController without TabBar (on bottom) disappears

I want to use Segmented Control to choice between contact form and contact details in the contact ViewController in my app. The contact ViewController is managed by the TabBarController. But when switching by using the Segmented Control the TabBar on the bottom disappears.
I uploaded a sample project here: SegmentedControlTest
Is there a simple way to solve that issue?
Regards,
David.
Keeping the current structure you can:
Embed ContactFormVC in NavigationController (editor -> embed in -> NavigationController) and on the NavigationController property uncheck "Shows Navigation Bar"
On both ContactFormVC and ContactDetailsVC set its "presentation" property (under "Transition Style") to "Current Context"; Your storyboard will look like this
You should change your transition to push and pop instead of both "show" otherwise you'll keep adding on the navigation stack. It's easy to do via code, I can't find how to do this via storyboard. I also recommend changing the structure for your view controllers as suggested by previous answer.
The way I encourage you to do is to use single view controller with multiple container views.
*Connecting .swift code to storyboard. Make sure the class name on custom class section is the same as the class' name. In this case it's "ViewController.swift"
I download your sample project.
As your segue's type is show,and you want didn't want to disappear tabbar,I guess you only want to exchange the form view with detail view.Not show another viewcontroller.
You can solve it by create detail view not detail view controller.
An alternative solution is that you can change UITabBarController's viewControllers.

SWReveal Menu on Multiple View Controllers

I am developing an application where I have multiple view controllers who should be able to access the reveal side menu. I am not using the navigation controller though, and am just using regular view controllers and opening the menu with a button. On the first screen, which I have linked with sw_front, it works.
If I go to another screen which I added an sw_front segue to too, it won't work. How can I get it to work on all view controllers which are linked? It seems to only work on one...
Screenshot of storyboard:
Storyboard screenshot
Add reveal view controller before it where you want like first view controller .
And one more thing if you are Access from SW_rear ,then set_push method gave by swrevealviewcontroller.

Don't understand how the XCode project knows how to start with the Storyboard?

I'm looking into iOS development. I've setup a tab bar project with the tab bar template. Few things I don't get. (I've attached a screen shot showing what I'm seeing)
I don't see where the tab bar controller is told to start/do anything from the code created in the template? There's just the AppDelegate, the view controllers and that's it?
How would I get a table view to be displayed in the tab views? When I try to drag a table view onto the first view controller it doesn't let me.
Ideally I would use one of the Parse.com's table view subclasses for my table view, I presume I would have to set that up with code from one of the tab views viewdidload?
You can see on the left that a LaunchScreen.xib was created, but where is this screen run from? I can see no reference to it anywhere else in the project. How is it controlled? what tells it to appear and then to disappear?
Click on the Tab Bar Controller and in the View Controller properties click "Is Initial View Controller"
Double click on the first view controller, then drag a Table View onto the View Controller. Add a Table View Cell to the Table View.
If you want to use PFQueryTableViewController you should add a Table View Controller to the story board then connect. Do a Ctrl+Click Drag from the Tab Bar Controller to the new Table View Controller and select relationship segue > view controllers. In the .h file of your Table View Controller change UITableViewController to PFQueryTableViewController.
Here is a good tutorial that helped me: http://www.raywenderlich.com/50308/storyboards-tutorial-in-ios-7-part-1
Select the project file an then your target. Under general->Deployment info there is a entry Main Interface where you specify the main storyboard. And under Supporting Files (in the project navigator) there is the info.plist file where launch screen and main storyboard in defined.
I would change the type of the first view controller to a table view controller.
You can just drag a regular uitableviewcontroller in to the storyboard and then Identity Inspector in the right panel you can change the type to use the Parse.com's tableview type.
The Launchscreen as a .xib is new to iOS8 and is the view that is displayed while your app is starting. It used to be you could only supply a image.

How to integrate custom view with TabBar?

Well I wish there was some tutorial anywhere or any of the O'Reily Cookbooks would explain this but everyone only ever talks about using UITabBarController.
What I need in my app however is a custom view (basic UIViewController) with a NavigationBar (just for the title bar and a 'Done' button) and a TabBar in it.
The question is: How do I integrate the TabBar and connect views to each bar button (and add more bar buttons)? Can this only be done programmatically or is it possible in Storyboard? And which class needs to be the TabBarDelegate (I suppose my custom UIViewController)?
Does anyone know of a good guide for this or provide me with some hints?
Thanks.
UPDATE:
I decided to simply check in the TabBarDelegate for the tabBar.selectedItem.tag and instantiate a sub view accordingly from the storyboard and add it into a ContainerView that is sandwiched between my nav bar and the tab bar at the bottom. This works so far (although I'm not sure if there's not a better approach) but now I'm facing a different problem:
When a sub view is loaded into the ContainerView the whole tab bar disappears. Does somebody know why this happens?
It is very easy to crate Tab Bar Controller app with Storyboard. Apple even provides a snippet :) When creating a new project, just select iOS -> Application -> Tabbed Application.
Also, here is a pretty good tutorial: https://www.youtube.com/watch?v=RhsHtd6rAiQ.
Solved the original issue myself by creating a Xib with UIViewController in it and place a UITabBar and a UIView as container for subviews. Then load the xib with NSBundle.mainBundle().loadNibNamed() and create Xibs for the sub views that should be loaded and load these with loadNibNamed() and add them with viewContainer.addSubview().

Proper way to segue between two simple View Controllers in iOS 7

I'm mainly from a C# background, so the workflow for iOS is a bit unusual for me, at least for now.
I was having a problem having simple segue from a main menu, to a another menu/work area, and then with the ability to go back to the main menu.
For a test, apparently I did something wrong.
I didn't write any code for this test to exhibit the problem.
What I did was just,
create a new single-view app
drag an additional view controller onto the work area
drag the start arrow to the new view controller (so it becomes the initial view, same thing as checking the checkbox to set it as the initial view)
added a button to each view controller
Ctrl + clicked and dragged the buttons to the opposing view
for the segue type, I chose "replace"
now the program crashes if I hit the second button to go back to the "main menu" (green view controller in this example)
So what am I doing wrong? Do I need to add some form of delegate or something?
I did find this, though it present fewer segue options in the tutorial than what I have.
https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/SecondTutorial.html
These are the options I have when I Ctrl + Click from a button to another view
-Push
-Modal
-PopOver
-Custom
-Replace
"Have you embedded a navigation controller? You need to go to editor->embed in-> Navigation Controller. You need a navigation controller for push segue. – Kaushal Bisht"
This solved it for me. Now I'm just going to work on replacing the navigation bar with custom UI controls.
Thanks everyone! :)

Resources