小编Pav*_*kal的帖子

在更新到Xcode的新版本后,为什么我的Xcode插件(如clang格式)与Alcatraz一起安装后不再有效?

今天我更新到Xcode 6.3.2并且我无法运行Clang代码格式化 - 似乎它甚至没有安装.每次我更新Xcode,我都必须重新安装恶意软件和大多数软件包(为什么顺便说一句?),使它们可以在新版本的Xcode上运行.

这次我重新安装了所有软件包(如VVD文件管理器,颜色选择器等),但ClangFormat不起作用 - 它甚至没有出现在"编辑"菜单中.知道为什么吗?

顺便说一句.我试图重启Xcode以及Mac本身:)

编辑(解决方案):

Xcode 6.3.x的解决方案(如果这不起作用,请使用下面的常规解决方案.)

在终端中,输入以下内容:

find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add 9F75337B-21B4-4ADC-B558-F9CADF7073A7
Run Code Online (Sandbox Code Playgroud)

一般解决方案

通过终端获取新的UUID:

defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID
Run Code Online (Sandbox Code Playgroud)

将新的UUID添加到插件中的DVTPlugInCompatibilityUUIDs键(您的xcplugin文件 - > show package contents - > Contents/Info.plist

iphone xcode updates ios clang-format

45
推荐指数
5
解决办法
2万
查看次数

Swift 3 UITableView数据源方法viewForHeaderInSection发出警告

迁移到Swift 3后,我有以下方法:

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {}
Run Code Online (Sandbox Code Playgroud)

它给了我警告

实例方法'tableView(tableView:viewForHeaderInSection :)'几乎匹配协议'UITableViewDataSource'的可选要求'tableView(_:titleForHeaderInSection :)'

Fix-it提供将方法设为私有或添加@"nonobjc"注释.如何解决警告?

uitableview swift swift3 ios10 xcode8

19
推荐指数
1
解决办法
4946
查看次数

NSViewControllers和NSView没有获得恢复API调用

在Apple的文档中,他们说如果是基于文档的应用程序,你应该恢复调用(restoreStateWithCoder:和encodeRestorableStateWithCoder :)到NSApplication,NSWindow,NSWindowController,然后是整个响应者链(这里).

我想实现这个,但我只在NSWindowController/NSDocument子类中获得恢复调用,而不是NSViews或NSViewControllers.

我创建了一个新的基于文档的应用程序来测试这个(这里),但我只在NSDocument子类中获得了恢复调用,但是没有NSViewController或NSView.

测试项目的代码:

NSDocument子类(恢复工作):

class Document: NSDocument {

  override func restoreState(with coder: NSCoder) {
    super.restoreState(with: coder)
    // Gets called after reopening the app
  }

  override func encodeRestorableState(with coder: NSCoder) {
    super.encodeRestorableState(with: coder)
    // Gets called when leaving the window for the first time
  }


}
Run Code Online (Sandbox Code Playgroud)

NSViewController子类(恢复不起作用):

class ViewController: NSViewController {

  override func restoreState(with coder: NSCoder) {
    super.restoreState(with: coder)
    // Not called
  }

  override func encodeRestorableState(with coder: NSCoder) {
    super.encodeRestorableState(with: coder)
    // Not called
  } …
Run Code Online (Sandbox Code Playgroud)

macos state-restoration

7
推荐指数
1
解决办法
448
查看次数

如何使用Apple TV上的焦点引擎使UIView可聚焦

是否有可能UIView成为焦点?或者我应该只UIButton为所有可能的视图使用自定义?

我试图覆盖canBecomeFocused但没有发生任何事情.

apple-tv swift tvos focus-engine

6
推荐指数
1
解决办法
5722
查看次数

UIButton – 默认图像高亮颜色是什么

有什么方法可以从某种颜色(假设它是 [UIColor redColor])创建该颜色的默认突出显示阴影(在这种情况下是某种深红色)。

就我而言,我有一个 UIButton(在 UIBarButton 内部),我想为 UIControlStateHighlighted 状态设置 titleColor,与 UIImage 的默认突出显示颜色相同。请参阅下面的代码:

UIColor *color = [UIColor redColor];
UIColor *highlightedColor = ???;

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

[button setImage:[[UIImage imageNamed:@"back-arrow"] imageWithOverlayColor:color] forState:UIControlStateNormal];
[button setImage:[[UIImage imageNamed:@"back-arrow"] imageWithOverlayColor:highlightedColor] forState:UIControlStateHighlighted];

[button setTitle:title forState:UIControlStateNormal];
[button setTitleColor:color forState:UIControlStateNormal];
[button setTitleColor:highlightedColor forState:UIControlStateHighlighted];

button.imageEdgeInsets = UIEdgeInsetsMake(0.f, -5.f, 0.f, 0.f);
Run Code Online (Sandbox Code Playgroud)

如果我没有为 UIControlStateHighlighted 状态设置图像/标题,则按下按钮时仅突出显示图像:

在此处输入图片说明

iphone objective-c uibutton ios swift

5
推荐指数
1
解决办法
4912
查看次数

在UIScrollView的子视图中绘制网格会分配大量内存

我正在尝试在UIScrollView中创建一个UIView,它只包含一个由UIBezierPath或CG函数淹没的简单网格(行和行).问题是,当我有更大的UIScrollView内容大小(以及更大的子视图)时,在绘制网格期间会分配大量内存(50MB或更多).

UIViewController,它在整个场景中只包含UIScrollView - 在viewDidLoad中添加子视图:

@interface TTTTestViewController()

@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;

@end

@implementation TTTTestViewController

-(void)viewDidLoad
{
    [super viewDidLoad];

    // create the subview
    TTTTestView *testView = [[TTTTestView alloc] init];
    [self.scrollView addSubview:testView];

    //set its properties
    testView.cellSize = 50;
    testView.size = 40;

    // set the content size and frame of testView by the properties
    self.scrollView.contentSize = CGSizeMake(testView.cellSize * testView.size, testView.cellSize * testView.size);
    testView.frame = CGRectMake(0, 0,  self.scrollView.contentSize.width, self.scrollView.contentSize.height);

    // let it draw the grid
    [testView setNeedsDisplay];
}

@end
Run Code Online (Sandbox Code Playgroud)

仅使用UIBezierPath/CG函数绘制网格的内部视图 - 取决于属性大小(行/列计数)和cellSize(网格中一个单元格的宽度/高度):

#define …
Run Code Online (Sandbox Code Playgroud)

memory drawing uiscrollview ios uibezierpath

1
推荐指数
1
解决办法
2155
查看次数