开发sketch插件

1、git安装模板  git clonehttps://github.com/MagicSketch/XcodeTemplate-SketchPlugin.git~/Library/Developer/Xcode/Templates/Sketch\ Plugin








**************************************************************************************
#import <Cocoa/Cocoa.h>

#import <WebKit/WebKit.h>

@interface MyViewController : NSViewController

    @property (weak) IBOutlet WebView *myWebView;

@end

**********************************************************************************



*******************************************************************

#import "MyViewController.h"

@interface MyViewController ()

@end

@implementation MyViewController

- (void)viewDidLoad {

    [super viewDidLoad];

    // Do view setup here.

    NSString *urlString = @"https://www.baidu.com";

    [[self.myWebView  mainFrame ] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]];

}

@end

****************************************************************************



****************************************************************************

@property (nonatomic, strong) NSWindow *myWindow;


- (void)onSelectionChange:(NSArray *)selection {

    //[_panelController selectionDidChange:selection];

    NSLog(@"selection");

    NSRect frame = CGRectMake(0, 0, 1880, 800);

    NSUInteger style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask;

    self.myWindow = [[NSWindow alloc] initWithContentRect:frame styleMask:style backing:NSBackingStoreBuffered defer:YES];

    //self.myWindow= [[NSWindow alloc] init];

    //2.设置窗口根控制器

    //2.1通过xib创建窗口的根控制器:initWithNibName

    //NibName:xib名称

    // MyViewController *vc = [[MyViewController alloc] initWithNibName:@"MyViewController"bundle:nil];

    //MyViewController *vc = [[MyViewController alloc] init];

    MyViewController *vc = [[MyViewController alloc] initWithNibName:@"MyViewController"bundle:[NSBundle bundleForClass:[self class]]];

    self.myWindow.contentViewController= vc ;

    //3.显示窗口

    [self.myWindow makeKeyAndOrderFront:self];

}

******************************************************************

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1.ios高性能编程 (1).内层 最小的内层平均值和峰值(2).耗电量 高效的算法和数据结构(3).初始化时...
    欧辰_OSR阅读 30,102评论 8 265
  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 11,530评论 1 32
  • 1.badgeVaule气泡提示 2.git终端命令方法> pwd查看全部 >cd>ls >之后桌面找到文件夹内容...
    i得深刻方得S阅读 4,928评论 1 9
  • 我想人生境遇多有不同,不管在什么时候,都要记得专注于你自己做的事情,一定会有成效的,那些打不死你的都将让你更强大!...
    麦青青阅读 221评论 0 0
  • 文/向璐 我以前是个【非专业填词人】,写了近百首歌词。但那只是我用来锻炼文笔的,其实我的梦想是当一名作家。但一直以...
    向璐LousanHeung阅读 967评论 2 5

友情链接更多精彩内容