ios - Pass UISwitch State from One View Controller to Another ViewController -


i have uiswith in viewcontroller a. want pass state of uiswitch viewcontroller b. using objective c. code i'm using in viewcontroller a:

if (![switchview ison]) {                 nslog(@"off");                } else {                 nslog(@"on");                 [comment setobject:@"yes" forkey:kesactivityprivatekey];             } 

i need save value of uiswitch in viewcontroller b.

any appreciated.

don't try access view controller's view hierarchy directly. should treat view controllers views (and switch kind of view) private.

set ibaction on switch points owning view controller. in action save sate of switch property of view controller.

you can access property other view controller.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -