How to detect a pressed button and display it on another screen? Objective-c

I am new to iOS app development. I want to create a calculator application in iOS that has a split view. The left side is the History function in the scroll list, and the right side is the calculator itself. Now, looking at the History function of this application, I think that my program should recognize what has been pressed and display it in the scroll view when the Equal (=) button is pressed. Do you know how this will continue with Objective-C? I am using Xcode 4.5 and iPhone Simulator 6.0.

Thank Advance

-3
source share
2 answers

/ , .

/ , , ,

LeftView.h

@interface LeftView : UIView {
   //instance variables here
}
//properties here
//other methods here
-(NSInteger)giveMeTheValuePlease;
@end

LeftView.m

@implementation LeftView 
//synthesise properties here
//other methods implementation here

-(NSInteger)giveMeTheValuePlease {
   return aValueThatIsInteger; //you can do other computation here
}

RightView.h

  @interface RightView : UIView {
       //instance variables here
    }
    //properties here
    //other methods here
    -(NSInteger) hereIsTheValue:(NSInteger)aValue;
    @end

RightView.m

 @implementation LeftView 
    //synthesise properties here
    //other methods implementation here

    -(void)hereIsTheValue:(NSInteger)aValue {
         //do whatever you want with the value
    }

AViewController.m

@implementation AViewController.m
//these properties must be declared in AViewController.h
@synthesise leftView;
@synthesise rightView;

-(void)someMethod {
   NSInteger aValue = [leftView giveMeTheValuePlease];
   [rightView hereIsTheValue:rightView];
}

( iOS), , SO

/ /, , , Google, iOS.

0

.

.. 2 viewcontroller. , popover. , PopoverController (AnotherViewController).

@property BOOL isClicked; AppDelegate.h

AppDelegate.m @synthesize isClicked; ( )

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Override point for customization after application launch.

    isClicked = FALSE;
}

ViewController.m, , :

- (IBAction)citiesButtonClicked:(id)sender
{
    AppDelegate *delegate = [UIApplication sharedApplication].delegate;
    delegate.isClicked = FALSE;
}

- (IBAction)categoryButtonClicked:(id)sender
{
    AppDelegate *delegate = [UIApplication sharedApplication].delegate;
    delegate.isClicked = TRUE;
}

PopoverViewController (AnotherViewController) -(void)viewDidLoad

-(void)viewDidLoad {
{
    AppDelegate *delegate = [UIApplication sharedApplication].delegate;
    if (delegate.isClicked)
    {
        delegate.isClicked = FALSE;
        NSLog(@"popover clicked");
    }
    else
    {
        delegate.isClicked = TRUE;
        isClicked = YES;
    }
}

, . , .

0

All Articles