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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:03:55+00:00 2026-06-13T18:03:55+00:00

I have an instance of UICollectionViewCell ( lets call it c ). c has

  • 0

I have an instance of UICollectionViewCell ( lets call it c ).
c has a property child of type B*

@property (strong) B* child;

in B there is a declaration

@property (strong) C* parent;

in C.m I set

self.child.parent = self

In B.m I have code :

position = self.parent.center.x;

For some reason I can not access center property of UIVIew from outside the instance. Is it private ? I looked in UIView.h and in the documentation. I dont see it being private.

Accessing self.parent in B.m is giving me the correct values …

So why cant I access it ? In C.m

self.center

is working as expected …

EDIT : With the real code

This is the so-called “C.h”

#import <UIKit/UIKit.h>
#import "UIMovableImage.h"

@interface LetterCollectionCell : UICollectionViewCell

@property (weak, nonatomic) IBOutlet UIImageView *letterCellView;

@end

This is “B.h”

#import <UIKit/UIKit.h>

@class LetterCollectionCell;

@interface UIMovableImage : UIImageView
{
    CGPoint currentPoint;
}
@property (strong) LetterCollectionCell* parent;

@end

This is “C.m”

#import "LetterCollectionCell.h"
#import "LettersCollection.h"

@implementation LetterCollectionCell

-(void)PrepareImage:(int)index Hint:(BOOL)hint Rotate:(BOOL)rotate
{
    if ([_letterCellView respondsToSelector:@selector(parent)])
    {
       UIMovableImage* temp = ((UIMovableImage*)self.letterCellView);
       temp.parent = self;
    }     
}    

@end

And here is the “B.m”

#import "UIMovableImage.h"
#import "LetterCollectionCell.h"

@implementation UIMovableImage

- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
        // Get active location upon move
        CGPoint activePoint = [[touches anyObject] locationInView:self.parent];

        // Determine new point based on where the touch is now located
        CGPoint newPoint = CGPointMake(self.parent.center.x + (activePoint.x - currentPoint.x),
                                       self.parent.center.y + (activePoint.y - currentPoint.y));

 }
@end

Please note that the LetterCollectionCell’s letterCellView is of type UIImageView and not of type UIMovableImage. The reason is that I want to keep this declaration as a placeholder. In the Interface Builder I have two scenes where the LetteCollection is used. In one scene I set the imageview to be of UIMovableImage ( thru Inspector Window ) and at the other I left the image to be of type UIImageView. So the run-time will create the proper class upon different scenes and at the collection I check : if the image has a property “parent” – I set it up. Otherwise I dont.
It works fine, the assignment works just fine…. but the access is not

  • 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-13T18:03:56+00:00Added an answer on June 13, 2026 at 6:03 pm

    I found the reason.
    The whole question was barking at the wrong tree.
    In fact, the bug was at the other place and I just kept looking at the “Invalid Expression” int the debugger’s watch window.

    To sum up : accessing the “center” property worked just find under the circumstances described in the original question. The “Invalid Expression” of the debugger and a bug in a different place made me chase a wrong thing.

    I +1d the generally correct answers and comments but can not accept them since it may mislead people.

    Thanks to all for the help and the effort

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

Sidebar

Related Questions

I have a instance of Oracle Access Manager set up on Server A and
I have a instance variable declared as a retain property & then I released
I have a view set up with two UICollectionViews. Each of these views has
I have UIButton instance called card. I have an object called Representer, which has
I have an instance of the Department entity, which in turn has a relationship
I have an instance variable NSMutableArray* searchResults. First, I initialize it: self.searchResults = [[NSMutableArray
I am confused between NSString and NSMutable string usage. Suppose I have instance variables
I have an instance variable called @filtered_ratings = params[:ratings].keys However, if params[:ratings] is nil
I have an instance of the Popen class created through subprocess.Popen. I would like
I have an instance method that I'd like to invoke directly using the callback

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.