Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

AppFusion - 6 in 1!
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-27-2012, 04:33 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 310
Default animate view drawn with UIBezierPath

Hi,
I'm trying to animate a view where the drawRect draws a rounded rect using UIBezierPath.
if I do the animation the rounded rect seems to be stretched and olny if I add setNeedsDisplay it's display correctly (but even with this just at the end of the animation).
Am I missing something?

Code:
    [UIView animateWithDuration:3.4 delay:0.0 options:0
                     animations:^{
                         self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width + 50.0, self.frame.size.height);
                         [self setNeedsDisplay];
                     }
                     completion:nil];
Code:
- (void)drawRect:(CGRect)rect
{
    UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:18.0];
    [[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5] setFill];
    [path fill];
    
    [[UIColor grayColor] setStroke];
    path.lineWidth = 1.0;
    [path stroke];
}
melmoup is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 657
22 members and 635 guests
ADY, bandley, BrianSlick, Creativ, dacapo, Dattee, djbrooks111, gbenna, HDshot, IphoneSdk, iseff, jakerocheleau, jbro, joeallenpro, kampftrinker, linkmx, mer10, nimesh_158, Reyna, ukneeq, yurikus
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 160,619
Threads: 89,833
Posts: 383,490
Top Poster: BrianSlick (7,244)
Welcome to our newest member, yurikus
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:42 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0