小编Sco*_*tty的帖子

UIScrollView缩放后重绘子视图

我有一个带有子UIView(CATiledLayer)的UIScrollView - 然后我有一堆更多的子视图(其中一些是UITextViews)

缩放后,一切都很模糊.

我已经阅读了关于这个主题的各种文章,它们似乎都表明我必须处理scrollViewDidEndZooming然后'做一些变换的东西,弄乱框架并调整内容偏移'.有人可以让我摆脱痛苦,并解释这是如何工作的.

提前致谢...

uiscrollview ios

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

URL中的Unicode字符(一切正常-IE除外)

我有一些简单的HTML,其中包含指向另一个HTML文件的链接-但该文件名包含Unicode字符。根据我对链接进行编码的方式,Windows上的IE不会打开它-但是,相同的链接也可以在所有其他浏览器(Windows和Mac)上工作,任何指针都是最欢迎的。

这里似乎关键的是,我正在本地磁盘上打开HTML(即Web服务器未提供它)。

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>website</title>
</head>
<body>

<a href="%C3%A9.html">Fails on IE - works everywhere else (Firefox, Chrome, Safari)</a>
<p />
<a href="é.html">Works on IE</a>

</html>
Run Code Online (Sandbox Code Playgroud)

谢谢

克雷格

html unicode internet-explorer

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

在iOS上保存iCloud Drive安全范围URL(UIDocumentPickerViewController)

我正在尝试保存从iCloud文档选择器返回的安全范围URL(UIDocumentPickerViewController)

文件说明:

如果URL不是普遍存在的URL,请使用bookmarkDataWithOptions:includesResourceValuesForKeys:relativeToURL:error:方法并传入NSURLBookmarkCreationWithSecurityScope选项将书签保存到文件中.调用此方法会创建一个包含安全范围URL的书签,您可以使用该URL打开文件而无需进一步的用户干预.

但是,编译器说iOS上不支持NSURLBookmarkCreationWithSecurityScope.

谁知道这里发生了什么......?

cocoa ios icloud

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

iOS13 中的超级/下标似乎已损坏(NSAttributedString)

尝试在 UITextView 中使用 NSAttributedString 显示超级/下标文本似乎在 iOS13 中被破坏 - 除非有人知道否则?

奇怪的是,如果我使用 UIFont systemFont 那么它可以工作 - 但如果我使用任何其他字体它就不行。

请参阅下面的代码,以在我的测试应用程序中设置 UITextView。

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIFont* font = [UIFont systemFontOfSize:32];
    //UIFont* font = [UIFont fontWithName:@"Helvetica Neue" size:32];
    //UIFont* font = [UIFont fontWithName:@"Courier" size:32];
    //UIFont* font = [UIFont fontWithName:@"Arial" size:32];

    NSMutableAttributedString* as = [[NSMutableAttributedString alloc] initWithString:@"Super2Script" attributes:@{NSFontAttributeName : font}];

    [as addAttribute:(NSString*)kCTSuperscriptAttributeName value:@(1) range:NSMakeRange(5, 1)];



    UITextView* tv = [[UITextView alloc] initWithFrame:CGRectZero];
    tv.attributedText = as;
    [tv sizeToFit];

    [self.view addSubview:tv];
    tv.center = CGPointMake(self.view.bounds.size.width / 2, self.view.bounds.size.height / …
Run Code Online (Sandbox Code Playgroud)

nsattributedstring core-text ios13

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

使用NSDocument检测覆盖的文件

我有一个OSX应用程序,它使用NSDocument和autosaves inplace-一切正常.有时,用户会将文档保存到Dropbox同步文件夹中,然后有可能在应用程序中仍然打开文档时(通过Dropbox)更新文档.问题是,我如何检测这个并从磁盘重新加载文档(或至少通知用户.)

谢谢

macos cocoa nsdocument

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

在iOS8.0(和8.1)上使用第二个UIScreen自动调整问题

我的应用程序驱动第二个屏幕(外部显示器),但我看到一些关于旋转的"奇怪"事情(在iOS7上没有发生的事情)

如果我以横向方向启动应用程序(并连接第二个屏幕),然后按主页按钮将应用程序放入后台,然后重新打开应用程序,然后将第二个屏幕(连接到显示器)旋转90度并仅使用一半的屏幕.没有任何后续旋转修复此问题.

我非常有信心这是一个错误 - 但我很乐意另外知道.下面是在简单的单视图应用程序中重现它的代码.

谢谢

@interface AppDelegate ()

@property (nonatomic, strong) UIWindow* externalWindow;

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidConnect:) name:UIScreenDidConnectNotification object:nil];

    UIScreen* externalScreen = ([UIScreen screens].count > 1 ? [[UIScreen screens] objectAtIndex:1] : nil);
    if (externalScreen)
    {
        [self setupExternalScreen:externalScreen];
    }

    return YES;
}

- (void) screenDidConnect:(NSNotification *)aNotification
{
    UIScreen* externalScreen = (UIScreen*)aNotification.object;
    [self setupExternalScreen:externalScreen];
}

- (void)setupExternalScreen:(UIScreen*)externalScreen
{
    externalScreen.currentMode = externalScreen.preferredMode;

    self.externalWindow = [[UIWindow alloc] initWithFrame:externalScreen.bounds];
    self.externalWindow.screen = externalScreen;
    self.externalWindow.clipsToBounds = YES; …
Run Code Online (Sandbox Code Playgroud)

uiwindow ios uiscreen

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