Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7906477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:59:14+00:00 2026-06-03T10:59:14+00:00

simply I am beginner in developing on ipad and I need to draw rectangle

  • 0

simply I am beginner in developing on ipad and I need to draw rectangle at point x,y with width and height when i clicked or touched button .

I searched on google but i didn’t find anything working in button handler

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:59:16+00:00Added an answer on June 3, 2026 at 10:59 am

    Create rectangleButton in viewDidLoad method and write -(void)rectangleButtonSelected method in your ViewController.m. And also create class RectangleView of UIView.

    -(void)rectangleButtonSelected{
    
        RectangleView *temp = [[RectangleView alloc] initWithFrame:CGRectMake(0, 0, 60, 40)];
    
        temp.center = CGPointMake(arc4random()%100, arc4random()%200);
        NSLog(@"The Main center Point : %f  %f",temp.center.x,temp.center.y);
    
        [self.view addSubview:temp];
    
    }
    

    Implement - (void)drawRect:(CGRect)rect method in RectanglerView.m

    - (void)drawRect:(CGRect)rect
    {
    
        // Drawing code
    
        context =UIGraphicsGetCurrentContext();
        CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0);
        // And draw with a blue fill color
        CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1.0);
        // Draw them with a 2.0 stroke width so they are a bit more visible.
        CGContextSetLineWidth(context, 2.0);
    
    
        CGContextAddRect(context, self.bounds);
        CGContextStrokePath(context);
    
    
        // Close the path
        CGContextClosePath(context);
        // Fill & stroke the path
        CGContextDrawPath(context, kCGPathFillStroke);
    }
    

    I hope it will be helpful to you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a jQuery beginner, but I need to style the front-end of a CMS
I am a beginner in developing for the Android, so excuse me if this
I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I'm trying
So I am a beginner developer. And simply just want to have a UITabBarController.
must be some thing simply resolving, but as a beginner, i've already spend 2
A beginner here, developing for the iPhone, with an extremely simple question: What is
I've been tasked to draw eight lines, forming something like a regular eight-point star,
I'm just a beginner in Cocoa developing for Snow Leopard and I have problem
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
I am beginner trying to complete a simple JSON problem on SingPath which asks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.