Drawing Bezier curve,rectangle,Text

Discussion in 'iOS Programming' started by santoshgornal, Feb 25, 2009.

  1. macrumors newbie

    Joined:
    May 22, 2008
    #1
    Hi ALL,

    In my application i want to draw Bezier curves which includes Drawing rectangle,Square,and text
    i am using view Based template in iphone application please can any body provide details regarding this, i have used code

    CGRect rect =CGRectMake(10,20,300,300);
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextClearRect(ctx, rect);
    CGContextSetRGBFillColor(ctx, 255, 0, 0, 1);
    CGContextFillRect(ctx, CGRectMake(10, 10, 50, 50));
    CGContextSetRGBFillColor(ctx, 0, 255, 0, 1);
    CGContextFillEllipseInRect(ctx, CGRectMake(100, 100, 25, 25));

    but its not drawing any thing on the screen, please any body provide tutorials from scratch to creat graphics.

    thanks
    santosh
     
  2. macrumors member

    Joined:
    Jan 31, 2005
    Location:
    Sweden
    #2
    At a glance I'm noticing that your arguments to CGContextSetRGBFillColor are off; this function accepts floating point numbers between 0.0 and 1.0.
     
  3. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    Also make sure you're putting this code in the drawRect: method.
     
  4. thread starter macrumors newbie

    Joined:
    May 22, 2008
    #4
    Bezier curves,rectangle,Curves

    hi

    ihave tried these things, but i am not getting please can u provide me working code for cococa touch
     
  5. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #5
    I'd suggest looking at the Quartz Demo sample app.
     

Share This Page