home_controller.rb:
class HomeController < ApplicationController
def index
@title = "tags"
@posts = Post.tag_counts.collect do |tag|
Post.tagged_with(tag).first
end
@posts.flatten.uniq
@posts = @posts.paginate :page => params[:page], :per_page => 8
end
end
index.html.erb:
<%- for post in @posts -%>
...
I need to close a series of views and don't wont to write code for closing them one by one. Here's a sample code to illustrate what I mean:
//This is the method for placing the views. It's called at different times at runtime:
- (void)addNotePic:(int)number {
int indexNumber = ((110*number) + 10);
UIImage *image = [UIImage imageNamed...
OK here is a very basic iPad app that i am starting out with and I am already into issue. I have been doing iphone apps but in that too never implemented rotation things.. well here is the issue. This is a simple viewbased app build with interface builder that looks like this:
when i run the app, the vertical orientation has both elem...
I'm creating a custom UIControl that renders it's view via drawRect:. I want to use the existing backgroundColor property to permit customization via Interface Builder. However, if the backgroundColor is set, by the time drawRect: is called, the entire rectangle has already been filled in. I have opaque = NO and clearsContextBeforeDrawin...
Hi,
I have a UILabel inside a UIView and I want the label to be resized proportionally as the UIView is resize.
I was able to do so with a UIImageView but the label stays as big as I placed it in IB.
I have set the view contentMode to UIViewContentModeScaleAspectFit thinking that anything inside the UIView would be "aspect fit" but I ...
Hi all.
I am displaying 10 feed in UItable view and below i have added a button with name load more 20.. by clicking this button i am passing argument to the xml and in return i want to reload the table view with fresh content.
welll my question is that how to the view again.
i am trying somthing like this
-(IBAction)loadMore20
{
...
Hello everyone,
In my Project, I have a customised @interface GraphView: UIView. Hence GraphView is a subclass of UIView and is meant to show a graph.
Then, I create a new View Controller called Summary using a NIB. In the Interface builder, I just add a UIToolbar at the bottom of the View.
In the implementation of Summary, in the vie...
I have a UIScrollview with an IBOutlet mapped to ganttScroller. This UIScrollView has a UIView in it. I made the UIView in IB and its width is 100.
I then start to add buttons to that UIView (mapped via an IBOutlet scrollContent)
float test = [scrollContent frame].size.width;
for (int i=0; i<15; i++) {
UIButton *showButton = [U...
Hello everybody. I have a Main View that contatins uitableview, and i am pushing another view when the user taps on a row. I want only the child views to rotate and have written code for that. But the problem is once i push the view, it also enables the orientation on the Main View. when i rotate the main view to the left, the statusbar ...
Hey all!
Concept is that a user taps on an icon in a view, a copy of the icon pops up under the user's finger, and they can drag it around until they lift their finger. To do this, I desire the following
icon has touch event
add transparent whole screen UIView and paste a UIImageView containing the icon on it.
track touchMoves or a u...
So I've used CGAffineTransform to zoom in,
CGAffineTransform newTrans2 = CGAffineTransformScale(mainView.transform,1.05,1.05);
mainView.transform = newTrans2;
I do this 15 times to have an animation effect.
Now I would like to zoom out such that mainView fits the iPhone frame (0,0,320,480).
Besides, the user is able to pinch in and ...
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 loo...
I am using the iPhone toolchain on Linux and so I have no Interface Builder. So how could I layout my view in my ViewController subclass? For example, I want a UITextView in the middle of the screen? Should I do this in the loadView or viewDidLoad. Do I also have to set the view for the ViewController subclass to itself?
...
I have to do this:
1:CGRect originalSubviewFrame = subview.frame;
2:view.frame = (CGRect)newFrame;
3:subview.frame = originalSubviewFrame;
I think instructions 1 and 3 shouldn't be there but if I don't restore the subview shape, it change for some reason!?!?
I read the documentation but it's unclear.
...
hi everybody,
i have a small UIView, i fill it with some string data from net.
i want to it load just once. thats why i call it in appdelegate class.
CurrencyView *currView;
@property (nonatomic, retain)CurrencyView *currView;
in application didFinishLaunchingWithOptions:
CurrencyView *view=[[CurrencyView alloc] initWithFrame:CGRect...
I currently have two UIViews: one of a red background and the other blue. The blue view is a subview of the red view. What I would like to do is be able to "cut" out rectangles on the blue view so that the red view can be visible. How do you go about doing this?
...
Scenario 1:
For a UIViewController, is it better to (1) create an ivar for a UIView that I access again in 1 or 2 functions outside of loadView? Or, (2) should I just tag it in loadView and then use - (UIView *)viewWithTag:(NSInteger)tag to access it again in the other functions? I'm guessing that option 1 increases the memory by the siz...
Is there a way to let a view rotate forever, with an specified speed? I need that for an indicator kind of thing. I know there is this weird Lxxxxx00ff constant (don't remember it exactly) that stands for "forever".
...
I'm having some problems with something related to UIResponder / UINavigationController / EAGLview combination. Is there a way for me to step thru / view the, display hierarchy?
Something like
*UIWindow*
*UIView*
*SOME SUBVIEWS*
*OTHERVIEW*
*SOME SUBVIEW*
*SOME OTHER SUBVIEW*
I know that I can check, [view sub...
I need to load an action sheet on a GLSprite derived game. I tried adding a UIViewController but when I display the actionsheet none of my touches are registering, and I can't figure out how to close the action sheet and switch the view back to my game?
Should I only create a UIViewController when its needed, or all of the time? Rath...