It looks like you're new here. If you want to get involved, click one of these buttons!
@synthesize uiImageViewC1;
@synthesize uiLabelC1;
@synthesize uiImageViewC2;
@synthesize uiLabelC2;
-(void)hideDialogue{
[UIView animateWithDuration:0.5
animations:^(void) {
uiImageViewC1.frame = CGRectMake(250, 350, 0, 0);
uiLabelC1.frame = CGRectMake(30, 10, 0, 0);
} completion:nil];
}
-(void)showDialogue:(NSString *)dialogueID{
NSString* txt = @\"Defaukt text\";
NSString* adio = @\"Default audio location\";
NSDictionary *mainDictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@\"dialogues\" ofType:@\"plist\"]];
if (mainDictionary != nil){
NSLog(@\"showDialogue: mainDictionary != nil\");
NSDictionary *innerDictionary = [mainDictionary objectForKey:dialogueID];
if (innerDictionary != nil){
NSLog(@\"showDialogue: innerDictionary != nil\");
txt = [innerDictionary objectForKey:@\"text\"];
adio = [innerDictionary objectForKey:@\"audio\"];
}
}else{
NSLog(@\"showDialogue: mainDictionary == nil\");
}
CGSize size = [txt sizeWithFont:[UIFont systemFontOfSize:14.0] constrainedToSize:CGSizeMake(250.0f, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap];
UIImage *bubble = [[UIImage imageNamed:@\"BubbleLefthand.png\"] //41 X 39
resizableImageWithCapInsets:UIEdgeInsetsMake(19, 21, 19, 21)]; // UIEdgeInsetsMake: CGFloat top, left, bottom, right;
uiLabelC1.text = txt;
uiImageViewC1.image = bubble;
uiImageViewC1.frame = CGRectMake(250, 350, 0, 0);
[UIView animateWithDuration:0.5
animations:^(void) {
uiImageViewC1.frame = CGRectMake(250, 350, size.width + 60.0f, -(size.height + 30.0f));
uiLabelC1.frame = CGRectMake(30, 10, size.width + 20.0f, size.height);
} completion:^(BOOL finished) {
STLog(@\"ChildrenBookViewController: showDialogue ==> SPPECH BUBBLE ANIMATION COMPLETE. Switch Case: %d\", pageNum);
[self performSelector:@selector(hideDialogue) withObject:nil afterDelay:5.0];
}];
}
[self performSelector:@selector(showDialogue:) withObject:@\"1_C1_1\" afterDelay:3.0];
[self performSelector:@selector(showDialogue:) withObject:@\"1_C2_1\" afterDelay:10.0];
Replies
Also use UIViewAnimationOptionCurveEaseOut for a nicer animation. As it says the view will "ease out". There are others too, check out UIViewAnimationOptions.
Edit: If you want the animation to go a constant speed instead of easing you can use options:UIViewAnimationOptionCurveLinear
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome