sending string between views - iphone

i have 2 views
i m sending text in a button on 1st view to label on second view....
//////textfieldtolabelViewController.h
#import <UIKit/UIKit.h>
#import "seconview.h"
#interface textfieldtolabelViewController : UIViewController {
IBOutlet seconview *sec;
//IBOutlet UITextField *t1;
}
//#property(nonatomic, retain)IBOutlet UITextField *t1;
-(void)buttonclick:(id)sender;
#end
and its .m file is this
#import "textfieldtolabelViewController.h"
#implementation textfieldtolabelViewController
-(void)buttonclick:(id)sender
{
NSString *s = [sender titleForState:UIControlStateNormal];
//sec.ss = s;
[sec settext:s];
[self presentModalViewController:sec animated:YES];
}
- (void)dealloc {
[super dealloc];
}
#end
now there is second view naming seconview
.h file
#import <UIKit/UIKit.h>
#interface seconview : UIViewController {
IBOutlet UILabel *l1;
}
#property(nonatomic, retain)IBOutlet UILabel *l1;
-(void)settext:(NSString *)ss;
#end
and its .m file is ....
#import "seconview.h"
#implementation seconview
#synthesize l1;
//#synthesize ss;
-(void)settext:(NSString *)ss
{
l1.text=ss;
}
- (void)dealloc {
[super dealloc];
}
#end
this program did not show any error and runs fine but problem is that the text of button in 1st view does not appear in label on second view
but i made all connection perfectly.......

Most probably you didn't connect l1 to the actual label in the Interface Builder. Verify with the debugger, that l1 is not nil in your settext method

You can include the view controller containing the label in the view controller where you want it to change, and access it by allocating a copy of it.
For example, use something like this in textfieldtolabelViewController.m
#import "seconview.h"
-(void)buttonclick:(id)sender
{
NSString *s = [sender titleForState:UIControlStateNormal];
seconview *viewcontroller = [[seconview alloc] initWithNibName:#"seconview" bundle:nil];
[[viewcontroller l1] setText:s];
[viewcontroller release];
[self presentModalViewController:sec animated:YES];
}

the [self presentModalViewController:sec animated:YES]; should be above the setText
try it
-(void)buttonclick:(id)sender
{
NSString *s = [sender titleForState:UIControlStateNormal];
//sec.ss = s;
[self presentModalViewController:sec animated:YES];
[sec settext:s];
}
hope it will work....

Related

How to make your own delegate method?

I am trying to make my own delegate method for this I declare 'Mydelegate' protocol in forDelegate.h file.
#protocol Mydelegate <NSObject>
-(void)show:(NSString *)msg;
#end
then in my first viewController I make the property for this.I declare a method clickMe which is call on button press,that button is present in my firstviewcontroller .xib file.
#class SecondViewController;
#interface ViewController : UIViewController
{
id <Mydelegate> delegate1;
SecondViewController *secondController;
}
#property (assign) id <Mydelegate> delegate1;
-(IBAction)clickMe:(id)sender;
#end
and then after I adopt this protocol in my second view controller and define the method of this protocol
SecondViewController.h file
#class ViewController;
#interface SecondViewController : UIViewController <Mydelegate>
{
ViewController *viewController;
}
SecondViewController.m file
-(void)show:(NSString *)msg
{
NSLog(#"in delegate mathod");
}
-(void)viewDidLoad
{
viewController =[[ViewController alloc] initWithNibName:#"ViewController" bundle:nil];
viewController.delegate1=self;
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
Program is running but Mydelegate method 'show' is not call.
This will be a useful answer for your question.
In the implementation of ViewController, you should call the delegate's method..
-(IBAction)clickMe:(id)sender
{
[self.delegate1 show:#"Your String Param"];
}
Create one button on second view controller xib and connect method to that button then after click that button check your console.
#class ViewController;
#interface SecondViewController : UIViewController <Mydelegate>
{
ViewController *viewController;
}
-(IBAction)showmsg;
SecondViewController.m file
-(void)show:(NSString *)msg
{
NSLog(#"in delegate mathod");
}
-(IBAction)showmsg
{
[self show:];
}
-(void)viewDidLoad
{
viewController =[[ViewController alloc] initWithNibName:#"ViewController" bundle:nil];
viewController.delegate1=self;
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
#protocol CPUPerformanceDelegate <NSObject>
-(void)getUsedCpuOperations:(float)percent;
-(void)getKernelCpuOperations:(float)percent;
-(void)getIdleCpuOperations:(float)percent;
-(void)getUserCpuOperations:(float)percent;
-(void)getNiceCpuOperations:(float)percent;
#end
#interface CPUPerformance : NSObject{
processor_info_array_t cpuInfo, prevCpuInfo;
mach_msg_type_number_t numCpuInfo, numPrevCpuInfo;
unsigned numCPUs;
NSLock *CPUUsageLock;
}
#property(nonatomic,assign)id<CPUPerformanceDelegate>delegate;
#property(nonatomic,retain)NSTimer *updateTimer;
#end
Then
#import "CPUPerformance.h"
#implementation CPUPerformance
#synthesize delegate,updateTimer;
- (void)updateInfo
{
idlepercent = ((idle/total)*100);
userpercent = (user/total)*100;
syspercent = (sys/total)*100;
nicepercent = (nice/total)*100;
inUsepercent = (inUse/total)*100;
[delegate getIdleCpuOperations:idlepercent];
[delegate getKernelCpuOperations:syspercent];
[delegate getNiceCpuOperations:nicepercent];
[delegate getUsedCpuOperations:inUsepercent];
[delegate getUserCpuOperations:userpercent];
}
and finally
#import "CPUPerformance.h"
#interface SpecProjectFirstViewController : UIViewController<UITableViewDataSource,UITableViewDelegate,CPUPerformanceDelegate>{
//Ivars
NSMutableArray *processArray;
//User Interface Object
UILabel *cpuUsage;
UILabel *cpuIdle;
UILabel *cpuUser;
UILabel *cpuNice;
UILabel *cpuKernel;
IBOutlet UITableView *tableViews;
CPUPerformance *cpuObject;
}
=================
#import "SpecProjectFirstViewController.h"
#implementation SpecProjectFirstViewController
-(void)getIdleCpuOperations:(float)percent{
[cpuIdle setText:nil];
[cpuIdle setText:[NSString stringWithFormat:#"Idle :%.0f %%",percent]];
[cpuIdle setTextAlignment:UITextAlignmentCenter];
}
-(void)getKernelCpuOperations:(float)percent{
[cpuKernel setText:nil];
[cpuKernel setText:[NSString stringWithFormat:#"Kernel :%.0f %%",percent]];
[cpuKernel setTextAlignment:UITextAlignmentCenter];
}
-(void)getNiceCpuOperations:(float)percent{
[cpuNice setText:nil];
[cpuNice setText:[NSString stringWithFormat:#"Nice :%.0f %%",percent]];
[cpuNice setTextAlignment:UITextAlignmentCenter];
}
-(void)getUsedCpuOperations:(float)percent{
[cpuUsage setText:nil];
[cpuUsage setText:[NSString stringWithFormat:#"Used :%.0f %%",percent]];
[cpuUsage setTextAlignment:UITextAlignmentCenter];
}
-(void)getUserCpuOperations:(float)percent{
[cpuUser setText:nil];
[cpuUser setText:[NSString stringWithFormat:#"User :%.0f %%",percent]];
[cpuUser setTextAlignment:UITextAlignmentCenter];
}
-(void)viewDidAppear:(BOOL)animated{
cpuObject = [[CPUPerformance alloc]init];
cpuObject.delegate = self;
[self creatObjectsOnView];
[super viewDidAppear:animated];
}

How to pass test filed value from one view to other?

I am making an application were i have two pages :
page1
in which i have 1 textfield and one submit button.
when user enter the value in a text field,the value entered in a textfiled should get display on next page.
page2 have
1 textfield to display the value ,entered in a first page and an edit button,to edit the text if he want's
if he click on edit button he should move to page one,were he can see the value he has entered and should change
I am able to pass textfield value from one page to other but not able to display the same value on page one when user click the edit button..
following is my page1 .h file
#import <UIKit/UIKit.h>
#import "new.h"
#interface tryViewController : UIViewController {
IBOutlet UITextField *textField;
}
#property(nonatomic,retain)IBOutlet UITextField *textField;
-(IBAction)submit;
#end
following is my page1 .m file:
#import "tryViewController.h"
#implementation tryViewController
#synthesize textField;
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
[theTextField resignFirstResponder];
return YES;
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
-(IBAction)submit
{
new *pg = [new alloc];
pg.str = textField.text;
[self .view addSubview:pg.view];
[self presentModalViewController:pg animated:YES];
}
#end
following is my page2 .h file:
#import <UIKit/UIKit.h>
#import "tryViewController.h"
#interface new : UIViewController {
IBOutlet UITextField *txtField;
NSString *str;
}
#property(nonatomic,retain)IBOutlet UITextField *txtField;
#property(nonatomic,retain)NSString *str;
-(IBAction)back;
#end
following is my page2 .m file:
#import "new.h"
#implementation new
#synthesize str;
- (void)viewDidLoad {
txtField.text = str;
[super viewDidLoad];
}
- (void)dealloc {
[super dealloc];
}
-(IBAction)back
{
}
#end
Your code is ... strange.
Try to use class name beginning with a capital letter with an human readable name.
Why do you use modal view controller instead of navigation controller?
Try this kind of code:
EditViewController.h
#import <UIKit/UIKit.h>
#import "ShowViewController.h"
#interface EditViewController : UIViewController {
IBOutlet UITextField *textField;
}
#property(nonatomic,retain)IBOutlet UITextField *textField;
-(IBAction)submit;
#end
EditViewController.m
#import "EditViewController.h"
#implementation EditViewController
#synthesize textField;
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
[theTextField resignFirstResponder];
return YES;
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
self.textField = nil;
}
- (void)dealloc {
[super dealloc];
}
-(IBAction)submit {
ShowViewController *showViewController = [[ShowViewController alloc] initWithNibName:#"ShowViewController" bundle:nil];
showViewController.string = textField.text;
[self.navigationController pushViewController:showViewController animated:YES];
}
#end
ShowViewController.h
#import <UIKit/UIKit.h>
#interface new : ShowViewController {
}
#property(nonatomic,retain)IBOutlet UITextField *txtField;
#property(nonatomic,retain)NSString *string;
-(IBAction)back;
#end
ShowViewController.m
#import "ShowViewController.h"
#implementation ShowViewController
#synthesize string;
- (void)viewDidLoad {
[super viewDidLoad];
txtField.text = string;
}
- (void)dealloc {
[super dealloc];
}
-(IBAction)back {
[self.navigationController popViewControllerAnimated:YES];
}
#end
In your MainWindow.xib add a Navigation Controller (or create your project with the navigation controller wizard.
If you doesn't want a nab bar just add a
[navigationController setNavigationBarHidden:YES animated:NO];
in your application delegate.

Help me to understand the answer given

I have problem with UIModalTransitionStylePartialCurl when i rotate the device beacuse the curl is not rotating as i expected and i found the below extract of the answer but i am not able to undertsand.
i am not sure how to create a "rootviewcontroller" Property as told like below
So i am looking for your guidence to proceed further .I am really stuck with this thing for long days...
Thanks for any help:-
The SOURCE CODE I HAVE
//
// ModalViewExampleViewController.h
// ModalViewExample
//
// Created by Tim Neill on 11/09/10.
//
#import <UIKit/UIKit.h>
#interface ModalViewExampleViewController : UIViewController {
UIButton *showDefaultButton, *showFlipButton, *showDissolveButton, *showCurlButton;
}
#property (nonatomic, retain) IBOutlet UIButton *showDefaultButton, *showFlipButton, *showDissolveButton, *showCurlButton;
- (IBAction)showDefault:(id)sender;
- (IBAction)showFlip:(id)sender;
- (IBAction)showDissolve:(id)sender;
- (IBAction)showCurl:(id)sender;
#end
//
// ModalViewExampleViewController.m
// ModalViewExample
//
// Created by Tim Neill on 11/09/10.
//
#import "ModalViewExampleViewController.h"
#import "SampleViewController.h"
#implementation ModalViewExampleViewController
#synthesize showDefaultButton, showFlipButton, showDissolveButton, showCurlButton;
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
- (IBAction)showDefault:(id)sender {
SampleViewController *sampleView = [[[SampleViewController alloc] init] autorelease];
[self presentModalViewController:sampleView animated:YES];
}
- (IBAction)showFlip:(id)sender {
SampleViewController *sampleView = [[[SampleViewController alloc] init] autorelease];
[sampleView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:sampleView animated:YES];
}
- (IBAction)showDissolve:(id)sender {
SampleViewController *sampleView = [[[SampleViewController alloc] init] autorelease];
[sampleView setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentModalViewController:sampleView animated:YES];
}
- (IBAction)showCurl:(id)sender {
SampleViewController *sampleView = [[[SampleViewController alloc] init] autorelease];
sampleView.rootViewController = self;
[sampleView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentModalViewController:sampleView animated:YES];
}
- (void)dealloc {
[showDefaultButton release];
[showFlipButton release];
[showDissolveButton release];
[showCurlButton release];
[super dealloc];
}
#end
//
// SampleViewController.h
// ModalViewExample
//
// Created by Tim Neill on 11/09/10.
//
#import <UIKit/UIKit.h>
#class RootViewController;
#interface SampleViewController : UIViewController {
RootViewController *rootViewController;
UIButton *dismissViewButton;
}
#property (nonatomic, retain) IBOutlet UIButton *dismissViewButton;
#property (nonatomic, retain) RootViewController *rootViewController;
- (IBAction)dismissView:(id)sender;
#end
//
// SampleViewController.m
// ModalViewExample
//
// Created by Tim Neill on 11/09/10.
//
#import "SampleViewController.h"
#implementation SampleViewController
#synthesize rootViewController;
#synthesize dismissViewButton;
- (IBAction)dismissView:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
[super viewDidUnload];
}
- (void)dealloc {
[dismissViewButton release];
[super dealloc];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
[self dismissModalViewControllerAnimated:YES];
return YES;
}
#end
UIView Animation: PartialCurl ...bug during rotate?
I too had this issue and somewhat gave up. However, I mentioned my
dilemma to a friend, who encouraged me to look into the child VC's
logic and I recalled a handy trick that I've used to pass data between
parent/child view controllers.
In your flipside view controller, create a "rootViewController"
property. In your parent view controller, when you initialize the
flipside view controller, you set (where "self" is the rootVC):
flipsideController.rootViewController = self;
You then use this for your flipside VC's
shouldAutorotateToInterfaceOrientation method:
-
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{ return interfaceOrientation ==
self.rootViewController.interfaceOrientation;
}
Viola! The flipside view no longer rotates underneath the partially
curled up parent view!
#From the post : In your flipside view controller, create a "rootViewController" property.
#import <UIKit/UIKit.h>
#class ModalViewExampleViewController;
#interface flipSideViewController : UIViewController {
ModalViewExampleViewController *rootViewController;
}
#property (nonatomic, retain) ModalViewExampleViewController *rootViewController;
#end
and in your flipSideViewController's implementation file
#import "ModalViewExampleViewController.h"
#synthesize rootViewController;

Changed nib File to a OPGL ES View, Buttons don't work

Hy,
There is no problmen with changing the nib but when I'm in the nib-File with the OPGL ES view my buttons that are integrated in this view won't work. When I press one the application crashes.
This is the Code how I change the View to the Second Nib:
- (IBAction)drawEAGLView:(id)sender {
NSArray* nibViews = [[NSBundle mainBundle] loadNibNamed:#"settingsViewController" owner:self options:nil];
EAGLView* glView = [ nibViews objectAtIndex: 1];
self.view = glView;
[glView startAnimation];}
The Animation is working .
This is the Code of the ViewController where the Button is declared:
SettingsViewController.h:
#import <UIKit/UIKit.h>
#interface SettingsViewController : NSObject {
IBOutlet UIButton *wowButton;
}
#property(nonatomic,retain) IBOutlet UIButton *wowButton;
- (IBAction)wowButtonPressed:(id)sender;
int testvarAnimation;
int animNext;
#end
SettingsViewController.m:
#import "SettingsViewController.h"
#implementation SettingsViewController
#implementation SettingsViewController
#synthesize wowButton;
- (IBAction)wowButtonPressed:(id)sender{
NSLog(#"TOUCHED");
//testvarAnimation = 1;
animNext =1;
}
- (void)dealloc {
[wowButton release];
[super dealloc];
}
#end
Here I show you how I connected the Functions and the Outlets:
http://s3.imgimg.de/uploads/screenshotConna91ea645png.png
Please tell me If you need more informations.
Thanks
Hy I solved my problem, I rewrote my drawEAGLView Methode:
- (IBAction)drawEAGLView:(id)sender {
SettingsViewController *sViewController = [[SettingsViewController alloc] initWithNibName:#"SettingsViewController" bundle:nil];
[[self.view superview] addSubview:sViewController.view];
}
I also corrected my SettingsViewController.h:
#import <UIKit/UIKit.h>
#class EAGLView;
#interface SettingsViewController : UIViewController {
IBOutlet UIButton *wowButton;
EAGLView *glview;
}
#property(nonatomic,retain) IBOutlet UIButton *wowButton;
#property (nonatomic, retain) IBOutlet EAGLView *glView;
- (IBAction)wowButtonPressed:(id)sender;
int testvarAnimation;
int animNext;
#end
And last but not least I changed my SettingsViewController.m:
#import "SettingsViewController.h"
#import "EAGLView.h"
#implementation SettingsViewController
#synthesize wowButton, glView;
- (IBAction)wowButtonPressed:(id)sender{
NSLog(#"TOUCHED");
//testvarAnimation = 1;
animNext =1;
}
- (void)viewDidLoad {
glView.animationInterval = 1.0 / 60.0;
[glView startAnimation];
[super viewDidLoad];
}
- (void)dealloc {
[wowButton release];
[super dealloc];
}
#end
I also changed my Nib file. I removed the ViewController and set the type of the File's Owner to my viewController named "SettingsViewController". I connected the File's Owner Outlet view with the EAGLView and the button with the SettingsViewControllers wowButtonPressed Method
I hope I could help also someone else,
Thanks
Here is the right solution for this problem:
First you have to create a parnet object of your view you want to be shown as first.
You need to do this in the header file of the second view.
//
// SettingsViewController.h
// NeheTutorial2
//
// Created by Global Sound on 05.04.11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
#class EAGLView;
#class mobilesynthViewController;
#interface SettingsViewController : UIViewController {
IBOutlet UIButton *wowButton;
IBOutlet UIButton *optiButton;
EAGLView *glView;
//mobilesynthViewController *mViewController;
mobilesynthViewController *parent;
}
#property(nonatomic,retain) IBOutlet UIButton *wowButton;
#property(nonatomic,retain) IBOutlet UIButton *optiButton;
#property (nonatomic, retain) IBOutlet EAGLView *glView;
//#property(nonatomic,retain) IBOutlet mobilesynthViewController *mViewController;
#property (nonatomic, retain) mobilesynthViewController *parent;
- (IBAction)wowButtonPressed:(id)sender;
- (IBAction)optiButtonPressed:(id)sender;
int testvarAnimation;
int animNext;
int musicOn;
int isAnimating;
float zaehler;
#end
Now in the implemetaion File you need to add the parent object to your function:
#import "SettingsViewController.h"
#import "EAGLView.h"
//#import "mobilesynthViewController.h"
#implementation SettingsViewController
#synthesize wowButton, optiButton, glView;//,mViewController;
#synthesize parent;
- (IBAction)wowButtonPressed:(id)sender{
NSLog(#"TOUCHED");
[parent startThread];
[parent showbButtonStop];
testvarAnimation = 0;
animNext =1;
//musicOn =1;
}
- (IBAction)optiButtonPressed:(id)sender{
NSLog(#"OPTIONS ON");
[self dismissModalViewControllerAnimated:YES];
[parent showbButton];
//mobilesynthViewController *aRootViewController = [[mobilesynthViewController alloc] initWithNibName:#"mobilesynthViewContoller" bundle:nil];
//[self setRootViewController:aRootViewController];
//[aRootViewController release];
//mobilesynthViewController *mViewController = [[mobilesynthViewController alloc] initWithNibName:#"mobilesynthViewController" bundle:nil];
//[[self.view superview] addSubview:mViewController.view];
//self.view = mViewController;
//CGRect rect = [[UIScreen mainScreen] applicationFrame];
//mViewController = [[mobilesynthViewController alloc] initWithFrame:CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)];
//self.view = mViewController;
}
- (void)viewDidLoad {
glView.animationInterval = 1.0 / 60.0;
[glView startAnimation];
[super viewDidLoad];
}
/*
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
*/
- (void)dealloc {
[wowButton release];
[optiButton release];
[super dealloc];
}
#end
In my case I'm calling a other function in the main View of my program. When the button in the second view is pressed the function in the first view is called through the the parent object
[parent startThread];
Again the startThread methode was declerated in another view.
I hope I could help you.

Problem with a NSString that equals to (null)

I have an UIViewController named MainViewController
I have another UIViewController named LeftSharingViewController;
I would like to get and use the NSString from MainViewController in my LeftSharingViewController
I have a problem, I always get (null) instead of the NSString wanted value.
Here's my code and how does the NSString get it's value
MainViewController:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
leftWebViewString = [NSString stringWithString:leftWebView.request.URL.absoluteString];
}
LeftSharingViewController.h:
#import <UIKit/UIKit.h>
#import "MainViewController.h"
#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>
#class MainViewController;
#interface LeftSharingViewController : UIViewController <MFMailComposeViewControllerDelegate> {
MainViewController *mainViewController;
NSString *leftWebViewUrl;
}
#property (nonatomic, retain) MainViewController *mainViewController;
#property (nonatomic, retain) NSString *leftWebViewUrl;
#end
LeftSharingViewController.m:
#import "LeftSharingViewController.h"
#import "MainViewController.h"
#implementation LeftSharingViewController
#synthesize mainViewController;
#synthesize leftWebViewUrl;
- (void)viewWillAppear:(BOOL)animated {
self.leftWebViewUrl = self.mainViewController.leftWebViewString;
}
#pragma mark -
#pragma mark Compose Mail
-(void)displayComposerSheet
{
MFMailComposeViewController *mailPicker = [[MFMailComposeViewController alloc] init];
mailPicker.mailComposeDelegate = self;
[mailPicker setSubject:#"Check Out This Website!"];
[mailPicker setMessageBody:[NSString stringWithFormat:#"Take a look at this site:%#", leftWebViewUrl] isHTML:YES];
mailPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:mailPicker animated:YES];
[mailPicker release];
}
Thanks!
On your MainViewController, you are never retaining the NSString you create. You are using stringWithString:, which returns an autoreleased object.
You should either retain it, or (easier) change your code to use your accessor, which already retains, like this:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
self.leftWebViewString = [NSString stringWithString:leftWebView.request.URL.absoluteString];
}
As a side note, if you are navigating from MainViewController to LeftSharingViewController, instead of "pulling" the data in LeftSharingViewController from MainViewController, I would do it the other way around:
In MainViewController, before displaying the view of LeftSharingViewController, I'd set the required properties.