How to add view like this - iphone

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.

Related

Making an Expanding Scrollview

I'm currently making a drawing application in Swift, but I wanted the page to be able to expand if the user wanted more room. I figured that I would use a UIScrollView to scroll around the canvas, but I wanted it to expand whenever the user went to the edge of the page, and for the UIImageView that I am drawing on to expand with it. Does anyone know how I would go about doing this?
Thanks!
In storyboard, drag a UIView into your UIScrollView then constrain that view to all sides of the scroll view. Then set the width to whichever value you would like (I would recommend to control drag from your view to the root view of the view controller and select equal widths), then give it a height constraint. Next, you need to connect an IBOutlet to your view controller code for the height constraint you set on the content view inside the scroll view. When you need to extend the page, add to the value of the height constraint and call layoutIfNeeded() on the scroll view.

Hiding or Removing UIImageView and arrangement (IOS 5)

I have a UIViewController that I designed in Interface Builder. near the top of the View it has a UIImageView and then some other Views (Text etc) below. These are set to anchor to the top of the view.
In code when the view loads I remove the UIImageView in certain circumstances but it still seems to take space or the view's below don't spring up to the top based on their Anchor.
How can I make the Views below move up if the View above is removed?
You can change the frame of the other elements in the view.
in the viewDidLoad method you can use something like that:
-(void)viewDidLoad{
if(imageVisible){
otherElements.frame = CGRectMake(....);
}else{
otherElements.frame = CGRectMake(....);
}
}
I don't know what is the structure of the view, but you might consider nesting all of the other elements in one view so you could change all the elements positions in one command.
Unlike the Android view hierarchies, iOS view hierarchies are all developed in absolute coordinates. When you say a subview is anchored to the top, that means that if the size of the parent view changes, your view will stay in the same relative position to the top of the screen.
In order to make your views below the image view move up when the image is hidden or removed, you will have to manually arrange them yourself to account for the offset

Centering the contentView within UIPopoverController

In my UIViewController that I use for my UIPopoverController, I have a label on top, a segmented control, and then a UITableView below it. When I created my .xib for the content view, I put in a table, and centered the label and segmented control within the .xib.
When I present the popover, I do not want it taking the whole screen. I use about (800,700) points to display the popover, but then the labels do not look right. They are not centered within the popover since the popover is now smaller than the .xib. What I did was move the label and segmented control to the left to make it centered in IB. That doesn't seem the best and future proof way of doing it. I was hoping I could do something programatically by taking the width size and dividing by 2 or something and centering based on that. Any advice? Thanks.
There are a couple of options:
Check out the documentation for the popoverContentSize property on the UIPopoverController, you should set it to be the size of the XIB that provides the content (so the XIB and popover both have the same size/contentSize, essentially).
Set the autoresizing masks on the subviews in the XIB so that they lay themselves out correctly dependant on the size of the XIB. To center them within their parent view you do NOT want the left and right mask setting (they should both be deselected in Interface Builder). This guide covers centering subviews: http://www.techotopia.com/index.php/IPhone_Rotation,_View_Resizing_and_Layout_Handling

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.