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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:49:31+00:00 2026-06-05T13:49:31+00:00

I have a strange problem that I’ve never encountered before, I have data in

  • 0

I have a strange problem that I’ve never encountered before,
I have data in my viewController that I want to display in a UIView.

It’s an iPad App which involve a SplitView Controller, when I click on an element within the table view (masterView) it execute a function in my detailViewController (via a protocol).

A function is executed which launch a UIView and send data to it:

myController:

- (void)SelectionChanged:(DocumentInfo*)document_info withDocu:(Document *)document{ 

    DocumentView *viewDoc=[[DocumentView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
    viewDoc.doc=document;
    viewDoc.doc_info=document_info;
    [viewDoc setBackgroundColor:[UIColor whiteColor]];

    [self.view addSubview:viewDoc]; 
}

DocumentView.h

#import <UIKit/UIKit.h>
#import "Document.h"
#import "DocumentInfo.h"

@class Document;
@class DocumentInfo;

@interface DocumentView : UIView

@property(strong,nonatomic) Document *doc;
@property(strong,nonatomic) DocumentInfo *doc_info;

@end

DocumentView.m

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {        
        UILabel *titreDoc=[[UILabel alloc] initWithFrame:CGRectMake(20, 32, 339, 21)];
        titreDoc.textColor = [self makeColorRGB_RED:66 GREEN:101 BLUE:149];
        titreDoc.font = [UIFont fontWithName:@"System" size:(24.0)];
        [self addSubview:titreDoc];
        NSLog(@"%@ - %@",doc,doc_info);
        titreDoc.text=@"Nouveau Document";
    }
    return self;
}

My view is well displayed (I mean the label appear) but impossible to get the data which would have been passed to it… (the NSLog print (null) (null) )

Anybody know the reason why?

  • 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-05T13:49:32+00:00Added an answer on June 5, 2026 at 1:49 pm

    The problem seems pretty straight forward. You initialize your view (which means that you run - (id)initWithFrame:(CGRect)frame) and after that you’re setting the data, so it’s normal that you see null values into your init method because the ivars have not being set yet. What you could do is to modify your init method in order to construct your view taking into account these ivars. Something like this perhaps:

    - (id)initWithFrame:(CGRect)frame doc:(Document *)doc docInfo:(DocumentInfo *)docInfo;
    

    ps. If you choose to make your custom init method do not forget to call the designated initializer (-initWithFrame:) before any customization.

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

Sidebar

Related Questions

I've been having a strange problem that I've never seen before. Now I have
I have encountered the strange problem, that linux c++ compiler includes the files from
I have a strange problem that i didn't encounter before i must mention that
I have a strange problem that I can't get my head around: I have
I have a strange problem that is only happening in a single location. I
I have a strange problem that I could not solve. When I try to
I have a strange problem that I can't seem to solve. I've quite a
I'm having a strange problem in that I have php inserting text into a
I have a some code below. My problem that i have a strange ending
I have a bit of a strange problem. I have a controller that is

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.