我使用终端创建podfile:
$ cd /Users/user_name/Desktop/CocoaPodsTest
$ touch Podfile
Run Code Online (Sandbox Code Playgroud)
但我在finder中找不到podfile,但我可以用'vim podfile'来编辑它.当我安装podfile时,它会显示以下信息:
[!]无法自动选择Xcode项目.在Podfile中指定一个,如下所示:
Run Code Online (Sandbox Code Playgroud)project 'path/to/Project.xcodeproj'
当我重新启动我的Mac,如果我安装pod,它显示此pod不存在!
它发生从我更新xcode版本到8.0.
我在中创建了一个 menuView self.view,menuView 有两个子视图,它们是 UIView。此 UIView 包含 4 个 UIButton ,但我无法单击其中任何一个。userInteractionEnabled设置是,按钮的框架在视图调试中设置正确。代码:
更新:Github 中的项目
视图控制器.m:
- (void)viewDidLoad {
[super viewDidLoad];
LeftMenuView *leftView=[LeftMenuView createLeftMenuView];
leftView.userInteractionEnabled=YES;
self.leftView=leftView;
[self.view addSubview:leftView];
//nightButton
UIButton *nightButton=[self.leftView viewWithTag:6];
[nightButton addTarget:self action:@selector(touchButton:) forControlEvents:UIControlEventTouchUpInside];
leftView.userInteractionEnabled=YES;
//set
UIButton *settingButton=[self.leftView viewWithTag:4];
[settingButton addTarget:self.leftView action:@selector(push) forControlEvents:UIControlEventTouchUpInside];
}
Run Code Online (Sandbox Code Playgroud)
**LeftMenuView.m:**这是一个 UIView 类。这是我设置按钮和菜单的地方。
-(instancetype)initWithFrame:(CGRect)frame
{
self=[super initWithFrame:frame];
self.backgroundColor=[UIColor colorWithRed:26/256.f green:31/256.f blue:36/256.f alpha:0.7];
[self addHeaderView];
[self addButton];
return self;
}
#pragma mark -add view to menu view
-(void)addHeaderView
{
UIView *headViewUp=[[UIView alloc]init];
headViewUp.userInteractionEnabled=YES; …Run Code Online (Sandbox Code Playgroud)