我title_label
在 Interface Builder 中创建了一个文本标签 ( ),我已经在我的FirstViewController.h
文件中声明了它,现在我想给它添加一个边框。我已经添加了执行此操作的代码,但是当我运行应用程序时,边框根本不会出现。
这是代码:
#import "FirstViewController.h"
#import <QuartzCore/QuartzCore.h>
@interface FirstViewController ()
@end
@implementation FirstViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
title_label.layer.borderColor = [UIColor greenColor].CGColor;
title_label.layer.borderWidth = 4.0;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
这是的内容FirstViewController.h
:
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController {
IBOutlet UILabel *title_label;
}
@end