Xcode Image Z-Index - iphone

is there a way to add a z-index to an image in xcode without having to create a new view. I'm pretty sure you can put the image into a new view and give the view the z-index, but I would rather do it without putting each image in their own views. Also, it must be programmatically, not using Interface Builder. I'm trying to stay away from using IB.

If by z-index you are referring to the order of subviews in a UIView, each subview has its own unique z index, so you'd have to create a new view for each image.

Related

How to add view like this

As shown click the top three buttons will pop up a view on the basic view. What the view is? CALayer? Or just a small size UITableView? How to implement this?
the control is like a UIPopoverController - but UIPopoverController is limited to iPad only. here's a source which have generic/custom implementation that will help you creating similar view.
https://github.com/werner77/WEPopover
I belevie this is a custom view that contains a table view inside it. it is very simple to implement that, As this is not a full tutorial I can imagine the basic steps I would do:
the shape could be a combination of layers or more reasonable drawn with Quartz2D:
I would do it this way:
create view and draw the frame with a BezierPath in the drawRect:
+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius
draw the top black bar and the title on the top.
draw the top triangle and add to the view a property that will set the position according to the button position. then you could conditionally change the draw position of the triangle.
add a sub view of a table view and assign the view as a DataSource and a Delegate of it, and then do all the table view implementation.
Good luck
It's just a custom view. There is probably a UITableView embedded in the view for the friend request list.

how do i work on a taller view in interface builder?

OK, so I am learning to use UIScrollView in interface builder. since the scrollView itself does not have any content, I created another view, the contentView, to hold my controls and scrollable content. into this view I place controls, labels, etc and then in my code i set the contentSize of the scrollView to the size of this contentView.
My question seems stunningly simple and so obvious that I must have missed something somewhere. when I created this XIB in IB I got your standard empty iPhone interface window. I dropped a scrollView on top of it, it took up the whole window. I dropped a view on top of that, it took up the whole scrollview. I added some controls, which so far I can still see inside the contentView rectangle in IB.
My question is how do I work on/add controls which lie outside of the visible part of the contentView in IB? LOL. it seems so simple, but i just don't get it. I can set the height of the content view or drag the rectangle to whatever I like (and indeed this is the whole point of having a scrollview) but the fixed UI window from IB won't expand so i can see the "offscreen" part of the contentView to add more controls. It's like it's just fixed at that size because that's the size of one iPhone screen and it won't let me make it any bigger/taller.
what did I do wrong?
-a
You need to turn off all simulated user interface elements (like the status bar) to be "undefined" except for size, which you select to be "Freeform" from the drop-down, and then you can set the view height using the Ruler tab to be whatever you like.
For example, here I've selected a photo view controller, and set the size in the right side bar to be "iPad Full Screen" - but I could also change that to "freeform" to set any height I wished.
First add a ViewController by any which way you prefer. Then in interface builder, click on the view controller Icon (on left). In the connections inspector click on the ruler icon "Show the size inspector". There will be option list for simulated size, change to "Freeform" and increase the height to any size you want. Hope this helps.
neeever mind. you drag the content view up so that some controls are offscreen and then add more controls/expand to the part you just made visible by moving the top stuff off the top. in effect, you physically scroll the contentView in IB by dragging it with the mouse. seems a smidge counterintuitive, but whatever.
Set simulated size to freeform for the the view controller to a large enough size that you can add in your controls
You don't have to create a view to place inside the scrollview if you don't want. In your case, it sounds like it doesn't make much sense.
As for the second part of your question, you can place items directly on the scrollview (it is a view afterall), as subviews. If you want them to be off screen, then just set their frame up to be at those particular x, y coordinates you want it to be at. You will have to ensure your scrollview's contentSize property is large enough though to house your entire content, this is what allows scrolling horizontally/vertically.
You probably want to do the offscreen elements programmaticly instead of using xibs.

Shadow inside UIView

I am working on iPhone application development and have come across shadows of UIView.
I know how to show shadows to a UIView but what I am actually interested in is to drop shadow inside the UIView.
Like when I set shadow properties of a UIView the shadow is dropped behind the view. I want it to come over the view so that the view looks as if it is pressed inside.
Example of such view is UITextField with roundedRect styling.
Thanks,
It depends a lot on the final effect you want to achieve.
The easies way would be a custom image with a prebacked shadow as background. This will give the illusion of a recession in the surface of the view. You can then add subviews to it as usual.
Alternatively, you can override the drawRect: method and draw the view as you like there, "inverted drop shadow" included.

Is there a way to resize TTThumbsViewController's grid?

I am using TTThumbsViewController to display a grid of thumbnails,
very easy. However the hard part is what if I want to display a custom
view at the bottom of the grid? And I don't want the view to be part
of the scrollable grid. How do I resize the thumbnail grid and then
attach my own view to this controller's view? Think of this view as a
custom toolbar kind of thing
You need to create a parent ViewController that contains the TTThumbsViewController and your own custom ViewController. If you need to programmatically resize the TTThumbsViewController you can access the actual view through the view property and sets it's frame property.

Can I use DrawRect on a UIImageView loaded from a NIB?

I've created a NIB file with some button controls on it, and as a background it has an ImageView which contains a PNG file loaded from my project.
What I want to do is to draw on top of the ImageView - imagine that my UI is a clockface and I want to draw the hands of the clock on top of the background image.
Is it the correct approach to try to subclass the UIImageView and use its DrawRect as when I use the DrawRect of the default view I don't see anything on the screen?
I'm a little lost as I'm finding this particular bit of the documentation hard to follow.
Thanks.
Create a new custom UIView (e.g. named HandsView) that sits on top of your background view (by adding it as a subview of the UIImageView). In the custom view, you can use the drawRect method. Make sure, you clear the context to transparent, so that the background image can be seen below the HandsView.
If you just want to draw turning hands, you can also try to use two fixed UIImageViews with the images of the hands and use the transform property to apply a rotation.