Show the custom view in window in objective C - ios

I'm showing a normal ViewController. Now i will tap on a button and all i want to see is like the following image:
In this image, the background is my root view controller and when i tap on the button, an image view that include black color(alpha = 0.8) will put on top and show my Custom View. In my Custom View, when i tap on DONE button -> the content of textField1 and textField2 will send back to rootViewController and hide my Custom View.
So, could you please help me for solve my situation? Tks in advance.

You can use the delegate & block programming to send the data back to the root View Controller.

Its simple, In Interface builder, Add a UIImageView to the view, and a UIView and connect them both to your .h file. Then set the imageView's values and buttons in custom view and And in your viewwillappear method in .m file, set them hidden using [imageView setHidden:YES];
And when you want to show them just set your setHidden to NO and you should be able to see the customView.

Related

How to add Tab bar and navigation bar in subviews using swift?

Please refer the image, where I have used the Navigation BarI tried surfing all over, but could not get the solution. Also, I am new to swift, so kindly help! I have a view controller -- Login page, which is connected to an another view controller-- CoreView.swift. I have created 5 subviews in CoreView ViewController. I want to add a Tab Bar where, user can click on the images of the Tab Bar and the corresponding subview should get open. Also, help me to add the images as the subview icon. the icon does not get displayed.
Also, when I try to put the back button from navigation controller, I can set the Title and prompt message, but not the back button in sub views, why so?
Thanks!
Look at this image to see the code and the xib file made
I have the following changes. but still no luck..
Regarding the navigation bar -> you should be able to just drat and drop the UIButton into your left bar button item:
EDIT: updated image to actually show xib implementation.
EDIT2: to link the button use this:
#IBAction func buttonTapped(sender: AnyObject) {
print("Back button tapped")
}
Make sure to connect the button in your interface builder to your custom view. You need to have a custom UIView subclass and should be chosen for your File's owner.

IOS - dim parent view when add a color picker subview

[Picker color view][1]
I would like to make a view (like the one in screenshot below). When the picker view shows up, the screen behind is faded just like the photo.
Thank for your help!!
I believe it's not hard to achieve this.
First, create a UIView called ColorPickerView and add some buttons with custom image to it(in your example, circles with different color).Then add the Cancel button so the user can remove(using removeFromSuperView) ColorPickerView by tapping it. Finally, add a UILabel to represent the title of ColorPickerView.
When the ColorPickerView show up, you should add a view on your mainPageView(Screen behind ColorPickerView). Let's call it blurView. Set the backgroundColor of blurView to black, alpha to 0.3(your choice). Similarly, when ColorPickerView is going to be removed, you should remove the blurView also.
You can remove blurView in the action of Cancel button.

UITableView set a web view and a button outside the web view as background

I am new to Swift. Currently I am building an app which has a tableview as the home page. I am trying to make a graph from a website(webView) and a button as the background view of the UITableView and display it only when cell is empty.
Is it doable?
How can I combine a webView and a button and set it as the backView using
tableView.backgroundView = (something here)?
The reason I am doing this is because I need to use the navigation controller for the segue. I have tried to put them in another view controller but then I cannot use push segue.
Thank you.
You can use TableViewCell as a container of your button and webview. I added the mainstoryboard screenshot.
Using custom cell in Table View explained here Custom Cell
Hope it helps.

UIActivityIndicator not appearing in Search View Controller

I have a UIActivityIndicator set up in storyboard like so
I have checked that the IBOutlet is set up properly, but the view still doesn't appear.
I've tried adding the following, but no change.
_spinner.hidden = NO;
[self.view bringSubviewToFront:_spinner];
_spinner.center = self.view.center;
[_spinner startAnimating];
I also tried adding the ActivityIndicator as a subview of the Search View Controller, but Storyboard wouldn't let me.
Also strange is that when I tried hiding the tableview before showing the spinner, the corresponding portion of the screen was black.
Put the code above in ViewDidLoad. And make sure animating property in the interface builder is turned on.
While seeing your image..
I think the search view controller is hiding the activity indicator view.
So, Keep the activity indicator view on top of table view of search view controller or
on top of search view controller at Interface Builder..
Hope it helps you..
If still not fixed..Please post entire code where you initialized activity indicator view at your implementation..(.m)

Toolbar on top of tableview

I'm trying to achieve to display a toolbar on top of a tableview. I'm working for iOS5 with storyboards I need a toolbar because it needs to be customized in a way a navigation controller does not allow me to do.
The following image shows what I want to achieve:
The left and right white arrows are what I think I can't achieve with the use of a navigationcontroller. Right now I got to display everything (The screenshot is from the iphone simulator), but my problem is that the toolbar scrolls with the table, and I would like it to stay on top. I think this is because of the way I wired up things in the storyboard. Next image shows a snapshot of what the view looks like in storyboard:
The controller is a subclass of UITableViewController. The toolbar is inside the tableview because the StoryBoard editor did not allow me to put it anywhere else.
I've tried to create a new generic view controller from the storyboard, drop a toolbar and a tableview and then set the type of the controller to my custom UITableViewController. Then the storyboard does allow me to have the toolbar on top and then the tableview. The problem is that when I run this version the program terminates with a
libc++abi.dylib: terminate called throwing an exception
So right now I don't know what to do. Is there any way I can make the toolbar stay on top? Can I accomplish my objective with a navigationcontroller (using storyboards) and thus make things easier?
Any help will be appreciated. Thanks.
Depending on how you want to behave, stationary or scrolling. You can add a subview to the
UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0, 44, 320, toolbarHeight)];
[self.navigationController.navigationBar addSubview:myView]
In 'myView' you can add all the buttons you need. Then you can leave the first cell empty.
Instead of using a TableViewController I would start with a simple ViewController then add a TableView and a Toolbar. It's going to take more code but I don't see how any of the "template" controllers will let you do what you want.

Resources