I have set a custom gradient color background for my nav bar. I want to set the same, matching color to some blank space I have at the bottom of my viewcontroller behind my UIButton.
This is the code I used for the navbar. How can I use the exact same color and set it just for that small square section?
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:35/255.0 green:161.0/255.0 blue:202.0/255.0 alpha:1.0];
Though your question is not too clear, what I can gather from it is that you want a matching toolbar, similar to the navigationbar, behind a button at the bottom of a view.
You can use the UIToolbar object: UIToolbar Documentation
Treat it like you would treat any other view.
To add it to your view controller use the following code:
This should be done before you add your button as a subview.
You did mention that you wanted to use that color for a square section for which you would modify the frame of the toolbar on the init.
After this, it would be good practice to add the button as a subview of the toolbar so if you want to move the button and the toolbar to some other place on the view, you only have to worry about one frame (the toolbar frame).
PS: The [toolbar release] call is made because adding a view as a subview increases it’s retain count. To keep the retain count = 1 and avoid memory leaks, this is a best practice. You may have known this already but just throwing it in there.
Again, your question wasn’t too clear so I’ve answered it based on what I understood from it.
If this isn’t the solution that you were looking for, maybe you could post some code or explain what you’re trying to do so that we could help you better 🙂
*******EDIT*******
correct answer: