0

In my application i have 8 files

ApplicationDelegate.h,ApplicationController.h and .m file for this RecordDelegate.h, RecordController.h and .m file for this

i declared webview in Applicationcontroller

while running the application

webview load with main.html file in this i have button record when i click the button navigate to record.html file here i have record audio and record video buttons,

here when, i click to record audio it navigate to RecordController.xib file here i have completed the record operations what i want means after complete record i want to use ApplicationController webview .. and here i want to pass some values to javascript in record voiddidload method i added the below code

ApplicationController *obj=[ApplicationController alloc]init];
[self.view addsubview:obj.Web_View];

it is not working any one know the reason Do you have any queries let me know?

Thanks

Bharathi D
  • 953
  • 1
  • 15
  • 28
  • Use custom class with property of UIWebView, pass it to the Controller, before load it, or make a singleton class to share it as a global variable. – Tom Jun 08 '12 at 07:19
  • i am new to ios... can you explain little briefly? – Bharathi D Jun 08 '12 at 07:25
  • Suppose you want to access a UIWebView property across two Controllers, and you can share it right? Make another class, but it's singleton, store this property to this class, and access it when you need it, for singleton class example, check this - http://stackoverflow.com/questions/145154/what-does-your-objective-c-singleton-look-like – Tom Jun 08 '12 at 07:35

2 Answers2

1

Navigate to Application Controller from RecordController.

Application Controller has already webview in it so synthesis webview object in RecordController and pass the value to Application Controller when you navigate.

Ronak
  • 974
  • 6
  • 14
  • i declared one webview in record page and here created object for Application controller like ApplicationController *obj=[ApplicationController alloc]init]; obj.Webview=WebView(record page webview) its not working – Bharathi D Jun 08 '12 at 07:34
  • Why you are declaring webview in record page its already there in application controller so just create object of application controller and access webview property – Ronak Jun 08 '12 at 08:40
  • created object for ApplicationController [self.view addSubview:obj.WebView]; – Bharathi D Jun 08 '12 at 08:51
  • This is not sufficient to identify where the problem is. – Ronak Jun 08 '12 at 08:53
0

This is a great tutorial for making a singleton: http://getsetgames.com/2009/08/30/the-objective-c-singleton/

When you want to use it you just call MySingleton.sharedMySingleton.yourVariable or if you want to call a method you type [[MySingleton sharedMySingleton] yourMethod]

Thoast83
  • 529
  • 5
  • 15