Floating a UILabel above OpenFlow - iphone

How do you get a UILabel to float above Alex Fajkowski's implementation of CoverFlow called OpenFlow?
Ok I've figured it out. I just had to use bringSubviewToFront with the UILabel.
Thanks to everybody who answered.

Make an OpenFlow instance and a UILabel instance subviews of a parent view, placing the label atop with flow view using -insertSubview:atIndex:, -addSubview: or similar e.g.:
[self.view addSubview:myOpenFlow];
[self.view addSubview:myLabel];

To answer the second question, try this: edit the AFOpenFlowView in IB and add the label view as a subview of that wherever you want it to appear, then set the attributes on the view to Hidden if you don't want it to appear by default. Create an IBOutlet for the label view in your controller so you can easily manipulate it, such as setting hidden to show in order to show it. I'm not familiar with open flow so I'm not sure if it will programmatically create a subview that will obscure your label. If so you may need to use the outlet to move it to the front using UIView methods.

The Openflow example code shows a perfect demonstration of this. Alex adds an info button in the top right of the openflow view using interface builder. This is exactly what you are asking for.
I would add that if you can't understand what is going on from the example code, you should look at more code examples from Apple demonstrating simple UIView usage.

It's not so easy because the label name has to change for each picture. We have to work with index, and with event.. move.. tap.. selected...I'm working on too !

Related

How to create a arrow above the table view

I need to design a view that look like some thing like this. I know this a UITableView below the top bar. but how i can create a arrow like shown in attach image.
Any guide will be helpful
Thanks
It's not about "Creating Arrow" above UITableView, it's about "Showing White Triangle" in the Image. Also , Changing the Image of UIButton is more Simpler.
Change this Image
with
It seems to be header view of table.
Use this methode
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 40)];
//create your view here. buttons lable image etc.
return view;
}
There can be different ways to implement this but a much easier way is to use this library SDSegmentedControl
Hope this helps.
You can create custom header view instead of giving the background view to all the table . add the background image to the header view with array pointing in the opposite direction .
just use an arrow image in uiimageview, as it is only above the uitableview.
If the arrow will move to other label for ex, series or title, then just change the frame of that arrow imageview(u can also use uiviewanimations). This is what I had done when I had the same issue.
If you're going to be changing the rest of the view depending on what button the arrow is on, you also might want to look into putting your UITableViewController inside of a UITabBarController. You won't be able to get the same colorscheme as you have in your screenshot I don't believe, but a lot of the behind-the-scenes work for changing the rest of the view depending on what is selected will be done for you (or will at least be much easier to set up). Also, Apple seems to tend to grumble about "non-standard interfaces" when you try to make up your own way of doing something that already can be done with the built-in UI framework.

Add UIView at a UIButton

Here is the requirement of my application:
There is a calendar type view which will show Date, Day, Total work hours of that day. What I need, when I click anywhere in that particular square block then it redirects my page to a new view.
I am thinking to should add multiple button and UIView on that button.
That can solve my problem but it is little bit problematic. How should I to do this?
Please look at UITapGestureRecognizer for your view. I think this is what you're looking for.
Here is a link to a tutorial on using UITapGestureRecognizer
Create a subclass of UIControl and a XIB with a UIView in it. Set the class type for the UIView to your new UIControl (not the file owner but the UIView). Then in the UIControl in the initWithCoder: method create the display component and add to view. Then set up you properties that you need to populate those controls.
To use this new control place a UIView where you want it on your screen and size it. Change its class type (in the inspector) to your new subclass. Now you can add outlets and actions to this view just like you would a UIButton. The only downfall is can't set the display controls from the inspector, you'll have to do that in the program. But the good side is you get a similar interface to a button and you can make it look anyway you like.
Hope this helps.

Updatable, custom view on a UIToolbar

I want to make a small area to present some information in the middle of a UIToolbar and was wondering what the best way to do this is.
I need to show some text and a graphic, both of which need to be updated (around every 3 seconds) as new information arrives. The graphic is similar to the iPhone signal strength indicator, so it can be either custom drawn or selected from one of 3 graphics (low, medium, high strength).
I'll probably use initWithCustomView: to create a UIBarButtonItem, although I would like the view to be clickable (to allow the user to change the information shown).
What's the best way to make that view? Can I use a NIB, or do I need to do custom drawing in the view? What's the best way to update the buttons? I'm assuming that I'll have to remake the toolbarItems array each time and set it when the information changes. Is there a cleaner way to do this? Thanks.
Using initWithCustomView: sounds like a good way to go. You can create your custom view any way you want: with a NIB, by drawing it, even using images. It can also have its own subviews. It can be any object that inherits from UIView. (So, if you wanted, you could even make it actionable by using a UIButton, a custom UIControl, or a custom UIView with a gesture recognizer attached.)
You shouldn't have to remake toolbarItems (or, for that matter, do anything with it after you've added all your button items) if you just keep a pointer to your custom view UIBarButtonItem. It could be an instance variable. Then, to update the custom view, you could access it as you would any other view. I've never actually tried this, but I can't see any problem with doing it.
You sound like you had it mostly figured out. Hope this is helpful.
I needed the same solution and was hoping for some code examples from you. So I ended up doing it all in IB and the steps are here as follows:
Create UItoolbar in IB with no Items. (A Bar Button Item will be added again once you add the UIView)
Add UIView as subview of UIToolbar
Add UILabels to subview of UIView that is already a subview of the UIToolbar.
Create IBOutlets from UIToolbar, UIView and each UILabel and then you can reference the labels in your app.
I did set the backgrounds to clearColor so the text appears on top of UIToolbar without any box or borders.
And the text updates dynamically which was the desired outcome.
Hope this helps someone as this has been eluding me for a while.

Background of my view hides buttons

I set an image as a background for my view but when I add buttons, it doesn`t appear, the image hides the buttons. Can you help me please :)
Although the answer Jonathan above is perfect, but as a reference you can use this thread as another approach to handle all the placements of the views and buttons.
So you have a UIView which contains a UIImageView (the background image) and some UIButtons?
When you add the UIButtons in code, do the following for each button:
[self.view bringSubviewToFront:aButton];
Did you actually put the buttons inside the view in the view hierarchy? They might just be behind it.

cocoa touch - problem updating subviews!

I have this UIViewController which contains an UIScrollView.
In the viewDidLoad method of the first controller, I create some UIViewControllers(defined through a NIB with an UILabel and an UIImageView inside,linking to IBOutlets done correctly), then I add them to the UIScrollView.
Problem is, I can see my views and scroll through them using the scroll view, but I seem to be unable to modify the text of the label and the content of the imageView using the methods [[UIViewController UILabel] setText] or [[UIViewController UIImageView] setImage]
I know it sound like a stupid question, but I can't get past it.
Any idea why?
Thank you guys.
You need to tag the Label and ImageView.
tag means assign a integer value to label and ImageView and you can access using the tag.
You can assign tags in xib.
Then you can access the view like this[someController viewWithTag:(int)];
I think I have resolved my problem. I was trying to modify the views before adding them to the UIScrollView.
If I call my methods after the [scrollview addSubView:myView], everything works fine.