刚接触osx的坑

2018-01-22  本文已影响229人  野生塔塔酱
platform : ios, '10.13'
target 'xxxx'

千万要注意写成osx

platform :osx, '10.13'
target 'xxx'

刚接触的时候没注意习惯性写成了ios 导入了一个AFNetWorking 一直报错又找不出原因 后来才发现这里错了

dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
.....

点击target,选择Capabilities,然后把Sandox项目下的Networking两个选项都勾上

    NSAlert *alert = [NSAlert new];
    [alert addButtonWithTitle:@"确定"];
    [alert addButtonWithTitle:@"取消"];
    [alert setMessageText:@"标题"];
    [alert setInformativeText:@"提示信息"];
    [alert setAlertStyle:NSWarningAlertStyle];
    [alert beginSheetModalForWindow:[self.view window] completionHandler:^(NSModalResponse returnCode) {
        if(returnCode == NSAlertFirstButtonReturn){
            NSLog(@"确定");
            [self.inputview setString:@""];
        }else if(returnCode == NSAlertSecondButtonReturn){
            NSLog(@"删除");
        }
    }];

http://blog.csdn.net/left_la/article/details/47659061 (改变背景色包括小箭头部分)

    _stateBtn = [[NSPopUpButton alloc] initWithFrame:CGRectMake(0, 100, 80, 30) pullsDown:NO];//pullsDown 如果为NO 那么第一个选项在下拉菜单中可选 如果为yes第一个选项不可选(不会出现) 适用于诸如第一个选项显示"城市"然后点开菜单显示具体城市名
    
    [_stateBtn addItemWithTitle:@"在线"];
    [_stateBtn addItemWithTitle:@"忙碌"];
    [_stateBtn addItemWithTitle:@"离开"];
    [_stateBtn addItemWithTitle:@"隐身"];
    
    [self.view addSubview:_stateBtn];
    
    //popBtn 的点击事件
    [_stateBtn setTarget:self];
    [_stateBtn setAction:@selector(handlePopBtn:)];

- (void)handlePopBtn:(NSPopUpButton *)popBtn {
    
    popBtn.title = popBtn.selectedItem.title;
    
    .......
}

①插入:[textView.textStorage insertAttributedString:text
                                     atIndex:oldSelectedRange.location];
②替换:[textView.textStorage setAttributedString:text];
上一篇下一篇

猜你喜欢

热点阅读