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 7766465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:25:30+00:00 2026-06-01T15:25:30+00:00

I have classes *ColorViewController *DrawRectangle In ColorViewController.h: #import DrawRectangle.h @interface ColorViewController : UIViewController {

  • 0

I have classes
*ColorViewController
*DrawRectangle

In ColorViewController.h:

#import "DrawRectangle.h"
@interface ColorViewController : UIViewController {
DrawRectangle *DrawRectangle;
}

@property (nonatomic,retain) DrawRectangle *DrawRectangle;

And in DrawRectangle.h:

@interface DrawRectangle : UIView {
CGFloat redc;
}
@property (nonatomic) CGFloat redc;

I have also added the DrawRectangle class in ViewController.xib to one of UIView.

I want to change the value of CGFloat redc from file ColorViewController.m
I’m doing it this way:

- (void)viewDidLoad
{
CGFloat myfloat = 1.0;
self.DrawRectangle.redc = myfloat;

I’m calling NSLog with this ‘redc’ in DrawRectangle, but it says 0.0000000 each time.

How can I replace the value of ‘redc’ from ViewController? I don’t think I need to use NSNotification, there must be easier way if I have the DrawRectangle loaded into ViewController.

  • 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-01T15:25:31+00:00Added an answer on June 1, 2026 at 3:25 pm

    Looks like your object hasn’t been instantiated yet. Try:

    -(void)viewDidLoad {
        [super viewDidLoad];
    
        CGFloat myfloat = 1.0;
        [drawRectangle setRedc:myfloat];
    }
    

    You should also avoid naming your objects the same name as the class as a general programming practice. I Would suggest renaming the object to drawRectangle.

    You also need to hook up your drawRectangle object in your xib

    @property (nonatomic, retain) IBOutlet DrawRectangle *drawRectangle;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have classes as below. public interface ITest <T> { public Set<T> methodHere(); }
I have classes in an Entities package, but I still want to run import
I have classes that are named exactly the same across different plug-ins that I
I have classes which have automatic properties only like public customerName {get; set;}. They
I have classes that are needed in both my web service and my server.
I have classes structured like this: Public MustInherit Class A ' several properties End
If I have classes of Type A and B: public class A { public
If I have classes A, B, C, D, E , and interfaces like X,
Assume I have classes A1 and A2 and a class B that has elements
I have downloaded a third party library and they have classes I need to

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.