I want to show float value from previous view controllers label to next view controllers label in ios. Help and guide me regarding the same
Asked
Active
Viewed 250 times
-1
-
are you using storyboard or xib – Code cracker Mar 18 '15 at 05:09
-
3http://oleb.net/blog/2012/02/passing-data-between-view-controllers/ and http://stackoverflow.com/questions/5210535/passing-data-between-view-controllers check these threads. Its already been answered multiple times and everybody here would like you to learn by doing .Providing solutions will feed you now but you would never have the taste of self learning – Muhammad Adnan Mar 18 '15 at 05:09
-
yes I am using storyboard – Anagha Magar Mar 18 '15 at 05:12
-
use NSUserDefaults then, you can get the logic by googling – Code cracker Mar 18 '15 at 05:15
-
1No, do not use user defaults, that's not what they're for. – rdelmar Mar 18 '15 at 05:28
-
String value I am able to pass but I am not getting how to pass float values – Anagha Magar Mar 18 '15 at 05:28
-
There's no conceptual difference between passing a float value and passing a string. Show what you've tried. – rdelmar Mar 18 '15 at 05:30
-
My first View Code : – Anagha Magar Mar 18 '15 at 06:17
-
My first view code : -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { MainViewController * mc; mc = [segue destinationViewController]; NSString * ch1 =[NSString stringWithFormat:@"%f",child]; //mc.Child = ch1.text; //NSString *ch1 =[] mc.Child = ch1.self; // mc.Child= child.text; } – Anagha Magar Mar 18 '15 at 06:24
-
My second view code which i tried @implementation MainViewController - (void)viewDidLoad { // self.child = self.child1; self.ch1 = _Child; – Anagha Magar Mar 18 '15 at 06:24
-
Don't put code in comments, it's hard to read. Edit your question to include properly formatted code. – rdelmar Mar 18 '15 at 06:26
1 Answers
0
1.First import Second view controller to First view controller
2.create float variable in Second view controller
3.at where you are pushing from First to Second view controller,there write code
//in First View Controller
-(ib action)move to second view
{
Second View Controller *sec obj=[Second View Controller new];
sec obj.float variable.text=[self.first label.text float value];
[self.navigation controller push viewcontroller:sec obj animated:nil];
}

Usharao
- 67
- 5