我有控制器
#import <UIKit/UIKit.h>
#import "ViewBoard.h"
@interface BallsViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *InfoLabel;
@property (weak, nonatomic) IBOutlet UIButton *nextBallButton;
@property (weak, nonatomic) IBOutlet UILabel *PointLabel;
@property (weak, nonatomic) IBOutlet ViewBoard *viewBoard;
- (IBAction)NewGame:(id)sender;
@end
#import "BallsViewController.h"
#import "Field.h"
@interface BallsViewController ()
@end
@implementation BallsViewController
@synthesize viewBoard;
- (void)viewDidLoad
{
[super viewDidLoad];
[self.viewBoard Draw:@"Fields"];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)NewGame:(id)sender {
self.viewBoard.canDrawBall = true;
[self.viewBoard Draw:@"Fields"];
}
@end
和UIView
@interface ViewBoard : UIView
@end
@implementation ViewBoard
-(void)sendScoreToUI{
int score = 10;
}
@end
如何将有关分数的信息发送到 UI 并将其设置为 label ?我想UIView
将此信息发送给控制器,而不是控制器从UIView
.