tags:

views:

131

answers:

1

How do I add a label which enters to my current view controller,

Animating from top;

i.e.

like a slider, it should come on screen,

I want to display details on it,

i know [self.view addSubView:myNewLabel];

but it doesn't make any animation,

I need animation.

+1  A: 

I think, I got the Answer by r&d.

Go to your view controller,

get to the viewDidLoad Method

add following code,

    UIView *aNewView;
aNewView=[[UIView alloc] initWithFrame:CGRectMake(0, -90, 320, 90)];
[aNewView setBackgroundColor:[UIColor brownColor]];
[aNewView setAlpha:0.87];

    UILabel *titleLabel;
titleLabel=[[UILabel alloc] initWithFrame:CGRectMake(20, 25, 280, 30)];
titleLabel.font=[UIFont systemFontOfSize:15];
titleLabel.text=@"SRK - Sagar R Kothari";
titleLabel.textColor=[UIColor whiteColor];
titleLabel.backgroundColor=[UIColor clearColor];
[aNewView addSubview:titleLabel];

CGRect frame = aNewView.frame;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.75];

frame.origin.y = 90;
frame.origin.x = 0;
frame.size.height=400;
self.view.frame = frame;

[UIView commitAnimations];


[self.view addSubview:aNewView];
sugar
You can also just animate the label instead of adding it to another view and animating that. Other than that you've got the right idea.
Travis Watkins