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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:07:41+00:00 2026-06-08T01:07:41+00:00

My problem is that in ProductNote class UIButton Action I did initWithNibName Notes Class

  • 0

My problem is that in ProductNote class UIButton Action I did initWithNibName Notes Class to show the popOver with a UITableView in Notes Class. I am fetching data from sqlite and then load it to UITableView in tableViewDidSelectRowAtindexPath:. I got the selectedNote and creates object of ProductNote Class to call selectedNote instance method that only set IBOutlet’s textview.text but its nil. Thats my problem, Below is the code please help me to knowing why i face this type of issue. I am using Xcode 4.3.3 and not using ARC. Manually I defined dealloc method on every ViewController

//**ProductNote.h Class****************************
#import <UIKit/UIKit.h>
@class Notes;
@interface ProductNote : UIViewController<UIPopoverControllerDelegate>
{
UIPopoverController *popOverController;
UITextView *txtmesssagenotes;
Notes *objNotes;
}
@property (retain, nonatomic) IBOutlet UITextView *txtmesssagenotes; //It is Connected to ProductNote.xib
@property (retain,nonatomic)  UIPopoverController *popOverController; 
@property (retain,nonatomic)  Notes *objNotes;
-(IBAction)presentPopOver:(UIButton*)sender;
 -(void)selectedNote:(NSString*)note;
@end

//ProductNote.m Class
@implementation ProductNote
@synthesize txtmesssagenotes,popOverController,objNotes;

-(IBAction)presentPopOver:(UIButton*)sender
{
self.objNotes=[[Notes alloc]initWithNibName:@"Notes"bundle:nil];
UIPopoverController *popOver=[[[UIPopoverController alloc]initWithContentViewController:objNotes]autorelease];
self.popOverController=popOver;
self.popOverController.delegate=self;
self.popOverController.popoverContentSize=objNotes.view.frame.size;
CGRect rect=[self.view convertRect:objNotes.view.frame fromView:self.view];
rect.origin.y+=110;
rect.origin.x+=23;
[self.popOverController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:0 animated:YES];
 //Then I get popOver with tableview 
}
-(void)selectedNote:(NSString*)note
{
 self.txtmesssagenotes.text=note;     
 //Here I am getting txtmesssagenotes=0X0 or nil. Using self or without self Please tell me the reason.
}
- (void)dealloc {
[txtmesssagenotes release];
[popOverController release];
[objNotes release];
[super dealloc];
}
@end

@interface Notes : UITableViewController
{
NSMutableArray *arrNotes;
NSString *selectedNote;
UITableView *tblNotes;
}
@property(nonatomic,retain)NSMutableArray *arrNotes;
@property(nonatomic,retain)NSString *selectedNote;
@property(nonatomic,retain)IBOutlet UITableView *tblNotes;
@end

//Actually I skip the other methods that makes larger program to read . other methods only    used to fetch data from sqlite and fill up the arrNotes that is used to fill all rows in the  tableview. 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
 self.selectedNote=[self.arrNotes objectAtIndex:indexPath.row];

//Here self.arrNotes valid object and contains the data, and assigns NSString object to self.selectedNote

ProductNote *productNote=[[ProductNote alloc]init];
[productNote selectedNote:self.selectedNote]; //after calling selectedNote i goto to selectedNote implementation or definition above.
[productNote release];

}
-(void)dealloc
{
[arrNotes release];
[selectedNote release];
[tblNotes release];
[super dealloc];
}
  • 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-08T01:07:44+00:00Added an answer on June 8, 2026 at 1:07 am

    Are you calling selectedNote: before your view has loaded?

    Just because you created a view controller with a xib doesn’t mean that it loads all your subviews immediately.

    The xib is parsed and all your views are created the first time that the view controller’s view property is asked for – this is usually just before it appears for the first time.

    Until then, all the IBOutlet connections will be nil.

    You need to store the text for your note as an NSString property of you view controller. Then, inside either viewDidLoad you need to call self.txtmesssagenotes.text=self.note; – viewDidLoad is automatically called just after your view is loaded so you are guaranteed to have all your IBOutlets set by then.

    You shouldn’t rely on your view objects to store the state of your app (in this case, the text of the note). If a low memory warning is received while your view controller isn’t visible then all your view objects will be deleted – they will only be recreated when your view controller becomes visible again – if you are storing your note string inside a UITextView then it might no be there the next time you ask for it 🙂 You should always store data in a property of your view controller (or somewhere else you control) and create your views using it.

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

Sidebar

Related Questions

I need to list images from the server. The problem is that, first image
Many tutorials say that when i have to pass data from controller to view
Simple problem that I can't figure out... How can I print a '%' character
The problem that I have is somehow very specific. I have to implement a
I have a problem that I'm working on for quite some time now. I
Here is a problem that has been bothering me a lot about Python, I
Im currently facing the problem that when i try to set focus on some
Seems to be a problem that many people have, but all the answers I
I'm facing a problem that I can summarize as it follows: I have a
I have the same problem that is listed in the following thread. WSDL first

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.