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

  • Home
  • SEARCH
  • 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 6212601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:32:45+00:00 2026-05-24T06:32:45+00:00

I work on a project for iPhone iOS4 with Xcode. From MainViewController I want

  • 0

I work on a project for iPhone iOS4 with Xcode.

From MainViewController I want to draw a little red square (fill only, not stroke) in MyView, a subclass of UIView. How can I pass position and RGB color of the square?

MyView.h (subclass of UIView)

 @interface {
 CGPoint position; // OK
 CGFloat[3] color; // ???
 }
 @property CGPoint position; // OK
 @property CGFloat color;    // ???

MyView.m

 @synthesize position; // OK
 @synthesize color;    // ???

MainViewController.h

 MyView *myRect;
 property IBOutlet MyView *myRect;

MainViewController.m

 @synthesize myRect;

 - (void) viewDidLoad
    myRect.position = CGPointMake (0, 0); // OK
    myRect.color = CGFloat [] = {255, 0, 0, 1}  // ??? 

I think I have no problems with the position of the square. But how can I pass the color of the square?

Thank you.

  • 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-05-24T06:32:45+00:00Added an answer on May 24, 2026 at 6:32 am
    [myRect setBackgroundColor:[UIColor colorWithRed:color[0] green:color[1] blue:color[2] alpha:1.0]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am starting a new client/server project at work and I want to start
I've got an iPhone project and my english Localizable.strings suddenly doesn't work anymore. I
I've been working on an iPhone project with iOS 4.0. I just downloaded Xcode
I'm currently working on an iPhone project where i want to present to the
I'm trying to work through Project Euler and I'm hitting a barrier on problem
I work on a project that uses multiple open source Java libraries. When upgrades
I'm starting work on a project using Rails, but I'm waiting for the 3rd
I recently had to work on a project where the previous developer modified the
I've started work on a project that will be primarily acting as a Sync
I've been doing a project at work recently focused on an almost entirely client-driven

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.