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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:36:41+00:00 2026-05-27T08:36:41+00:00

made an object, MyTextBoxCreator. i need to make lots of text boxes dynamically. i

  • 0

made an object, MyTextBoxCreator. i need to make lots of text boxes dynamically. i want to be able to pass in a frame to the method.

.h file
-(UITextField *) standardTextField: (CGRect *) myRec;


.m file
-(UITextField *) standardTextField: (CGRect *) myRect
{
    UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 30)];

    UITextField *myTextField = [[UITextField alloc] initWithFrame:myRect];
    myTextField.font = [UIFont fontWithName:textFieldFont size:textFieldFontSize];
    myTextField.borderStyle = UITextBorderStyleLine;
    myTextField.backgroundColor = [UIColor whiteColor];
    myTextField.textColor = [UIColor textFieldTextColor];
    myTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    myTextField.layer.borderColor = [[UIColor textfieldBorderColor]CGColor];
    myTextField.layer.borderWidth = 1.0f;
    myTextField.leftView = paddingView;
    myTextField.leftViewMode = UITextFieldViewModeAlways;
    myTextField.clearButtonMode = UITextFieldViewModeWhileEditing;

    return myTextField;
}

when i try to create the textfield with myRect for the CGRect, i get the error:

Sending 'CGRect *' (aka 'struct CGRect *') to parameter of incompatible type 'CGRect" (aka "struct CGRect')

i don’t understand whats wrong with passing in the CGRect…

  • 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-27T08:36:41+00:00Added an answer on May 27, 2026 at 8:36 am

    Don’t pass a pointer to the CGRect, just pass the structure itself.

    -(UITextField *) standardTextField: (CGRect) myRect;
    

    Note that it’s a structure, not an actual object.

    Though, if you need to pass in a pointer to the struct, you can dereference it:

    ...
    -(UITextField *) standardTextField: (CGRect *) myRect {
    CGRect rectStruct = *myRect;
    ...
    UITextField *myTextField = [[UITextField alloc] initWithFrame:rectStruct];
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to pass a custom made vector object containing data from background service
So i'm overriding dealloc method because the object is a composite object made up
I have a list named taskSubList which is made of object .I need to
I want to replace a home-made comment object by a proxy of django.contrib.comments.models.Comment. I
Im trying to write an object i made onto a file using Object output
I have an object made of points, lets say its point cloud, i want
I'm using libltdl in my C code to dynamically load libtool made shared object
I want to implement QuickLook API for preview of pdf file. I made a
I've made POCO object mapped to database like this: class MoneyObject { Money MoneyAmmount
I made a custom TObjectList descendant designed to hold subclasses of a base object

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.