小编Mc.*_*ver的帖子

iOS:USDZ文件中的闪电问题

我正在尝试用显示AR内容QLPreviewController。除了照明,其他一切都正常。如果我使用Xcode或macOS的快速预览来预览文件,则照明很自然,但是当我使用QLPreviewController对象预览时,它太暗了!有什么可能的方法来调整照明,比例和其他设置?

augmented-reality ios qlpreviewcontroller swift arkit

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

使用Xcode 5创建基于xib的界面

我正在尝试使用Singe View模板创建一个新的应用程序,但没有xib或storyboard选项使我的界面成为xib文件!为什么Apple会从iOS 7中删除xib?!! 如何使用xib接口文件创建应用程序?

在此输入图像描述

iphone xcode xib ipad

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

将rtf或文本文件加载到UITextView iphone sdk中

嗨我想知道我应该如何将rtf或文本文件加载到UITextView中我使用了几个代码但是没有用,

NSString* filePath = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"txt"];
myTextView.text = filePath;
Run Code Online (Sandbox Code Playgroud)

谢谢 .

iphone sdk ios4

9
推荐指数
3
解决办法
2万
查看次数

使用EGOTableViewPullRefresh更新表

我正在使用plist文件来填充我的表格单元格,现在我添加了EGOTableViewPullRefresh API来更新我的单元格,但我不知道如何将我的plist url文件与此API匹配

//this is my plist code that load from server 
     NSURL *url = [NSURL URLWithString:@"http://example.com/news.plist"];
     titles = [[NSArray arrayWithContentsOfURL:url] retain];
Run Code Online (Sandbox Code Playgroud)

编辑:

#pragma mark -
#pragma mark Data Source Loading / Reloading Methods

- (void)reloadTableViewDataSource{

    //  should be calling your tableviews data source model to reload
    //  put here just for demo
    _reloading = YES;
    [self.tableView reloadData];  

}

- (void)doneLoadingTableViewData{

    //  model should call this when its done loading
    _reloading = NO;
    [_refreshHeaderView egoRefreshScrollViewDataSourceDidFinishedLoading:self.tableView];

}


#pragma mark - …
Run Code Online (Sandbox Code Playgroud)

uitableview ios4

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

在iOS 7中展示UIImagePickerController的问题

我的应用程序仅以横向模式运行!所以我UIImagePickerController只知道纵向模式下的礼物,所以在iOS 6中,我创建了一个UIImagePickerController强制UIImagePickerController以纵向模式打开的子类:

@interface NonRotatingUIImagePickerController : UIImagePickerController

@end

@implementation NonRotatingUIImagePickerController

- (BOOL)shouldAutorotate {

    return NO;
}

@end
Run Code Online (Sandbox Code Playgroud)
//presenting picker controller :

UIImagePickerController *ipc = [[NonRotatingUIImagePickerController alloc]init];
ipc.delegate = self;
[self presentViewController:ipc animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

这在iOS 6中运行良好,但现在在iOS 7中,我的应用程序因此崩溃:

2013-10-31 14:56:01.028 Medad[1731:60b] *** Terminating app due to
uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason:
'Supported orientations has no common orientation with the
application, and shouldAutorotate is returning YES'
Run Code Online (Sandbox Code Playgroud)

如果我检查Portrait部署信息,可以解决此问题: 在此输入图像描述

问题是,如果我检查此选项,我的应用程序也会以纵向运行,但我不想要它!

我该如何解决这个问题?

iphone xcode objective-c ipad ios

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

tvOS:强制按钮进行聚焦

我有一个UIView按钮,并且需要在视图添加到按钮时将焦点设置在按钮上self.view,但我不知道为什么按钮在添加视图时不会聚焦!

 - (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator: (UIFocusAnimationCoordinator *)coordinator {



         if (context.nextFocusedView == backButton) {

             [UIView animateWithDuration:1 delay:0 usingSpringWithDamping:.40 initialSpringVelocity:.60 options:UIViewAnimationOptionAllowUserInteraction animations:^ {

                 context.nextFocusedView.transform = CGAffineTransformMakeScale(1.5, 1.5);
                 context.nextFocusedView.layer.shadowOffset = CGSizeMake(0, 10);
                 context.nextFocusedView.layer.shadowOpacity = 1;
                 context.nextFocusedView.layer.shadowRadius = 15;
                 context.nextFocusedView.layer.shadowColor = [UIColor redColor].CGColor;
                 context.nextFocusedView.layer.shadowOpacity = 1;

             } completion:nil];


         }

}
Run Code Online (Sandbox Code Playgroud)

我也尝试了其他属性:

- (void)openView {

        [backButton preferredFocusedView];
        [backButton canBecomeFocused];
        [backButton setNeedsFocusUpdate];

       [self.view addSubView:customView];
}

- (UIView *)preferredFocusedView {

       return [backButton preferredFocusedView];   
}
Run Code Online (Sandbox Code Playgroud)

但这些都没有奏效!

objective-c tvos

9
推荐指数
2
解决办法
1408
查看次数

从UIWebView中的AVPlayer获取视频URL

我试图通过这种方法检测从UIWebView播放的当前视频的URL:

func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool
    {

        NotificationCenter.default.addObserver(self, selector: #selector(playerItemBecameCurrent(notification:)), name: NSNotification.Name("AVPlayerItemBecameCurrentNotification"), object: nil)

        //urlTextField.text = webView.request?.url?.absoluteString

        return true
    }



  func playerItemBecameCurrent(notification:Notification)  {

        let playerItem: AVPlayerItem? = notification.object as? AVPlayerItem
        if playerItem == nil {
            return
        }
        // Break down the AVPlayerItem to get to the path
        let asset: AVURLAsset? = (playerItem?.asset as? AVURLAsset)
        let url: URL? = asset?.url
        let path: String? = url?.absoluteString
        print(path!)

    }
Run Code Online (Sandbox Code Playgroud)

此代码有效但视频网址不包含任何视频文件扩展名:例如,此处是YouTube和Vimeo视频ULR:

https://r5---sn-ab5l6nzr.googlevideo.com/videoplayback?mime=video%2Fmp4&requiressl=yes&clen=27257208&mn=sn-ab5l6nzr&mm=31&mv=m&mt=1499534990&key=yt6&ms=au&source=youtube&ip=107.182.226.163&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&initcwndbps=3565000&id=o-ACG22m-TtwyC8tSG_AHUJk3qOPvhUm1X_-qRjy07pjIx&ei=-hZhWZXcJ_aV8gS2tbCQDg&lmt=1497638262979584&ratebypass=yes&gir=yes&pl=25&expire=1499556698&dur=316.093&signature=94C8ED3E4AF64A7AC9F1B7E226454823B236CA55.C18F5F5D9D314B73EDD01DFC4EA3CEA1621AC6C7&ipbits=0&itag=18&cpn=Wb3RPNfJRcFx5P-x&c=MWEB&cver=1.20170706&ptk=TiTV2010%2Buser&oid=1nI2Jk44kRu4HLE6kGDUrA&ptchn=E2VhHmwp3Y_wZvgz_LJvfg&pltype=content
Run Code Online (Sandbox Code Playgroud)

和Vimeo:

https://36skyfiregce-vimeo.akamaized.net/exp=1499539063~acl=%2F222646835%2F%2A~hmac=dc3caeb64501f537e2795ee8e121aed75a7eed9ba4e1b921fe92c757fe06b314/222646835/video/778109097,778109103,778109102,778109101/master.m3u8?f=dash 
Run Code Online (Sandbox Code Playgroud)

uiwebview ios swift

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

Xcode 10.1在编译时冻结

我将Xcode更新为10.1版本,但每次运行或编译我的项目时,整个mac挂起并冻结,这使我关闭iMac或mac自动注销!为什么会这样?我实际上无法工作或构建和运行任何东西!我更新了java,macOS,关闭了所有应用程序,但仍然一直冻结.你有什么解决方案吗?

macos xcode

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

CATextLayer和字符之间的跟踪/间距

我正在使用CATextLayer,为了在iOS中使用自定义字体,我知道有简单的方法来使用自定义字体,Fonts provided by application但这是不同的字体.我想知道有没有办法改变每个角色之间的间距?我没有找到任何财产这样做!

编辑:

- (void)viewWillAppear:(BOOL)animated {
    CTFontRef font = [self newCustomFontWithName:@"yeki" 
                                          ofType:@"ttf" 
                                      attributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:16.f] 
                                                                             forKey:(NSString *)kCTFontSizeAttribute]];


    CGRect screenBounds = [[UIScreen mainScreen] bounds];

    normalTextLayer_ = [[CATextLayer alloc] init];
    normalTextLayer_.font = font;
    normalTextLayer_.string = str;
    normalTextLayer_.wrapped = YES;
    normalTextLayer_.foregroundColor = [[UIColor purpleColor] CGColor];
    normalTextLayer_.fontSize = 50.f;
    normalTextLayer_.alignmentMode =  kCAAlignmentRight;

    normalTextLayer_.frame = CGRectMake(0.f,100.f, screenBounds.size.width, screenBounds.size.height /1.f);
    [self.view.layer addSublayer:normalTextLayer_];
    CFRelease(font);
}
Run Code Online (Sandbox Code Playgroud)

iphone core-animation ios catextlayer

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

使用iTunes Store客户评论API

我正在使用iTunes商店的客户评论API,我有一些问题,一般的URL是这样的:

https://itunes.apple.com/us/rss/customerreviews/id=(APPID)/sortBy=mostRecent/json
Run Code Online (Sandbox Code Playgroud)

我有两个问题,第一个是我不想指定国家/地区,所以我删除了这样的国家/地区代码:

// /us/ has been removed from the URL 
https://itunes.apple.com/rss/customerreviews/id=(APPID)/sortBy=mostRecent/json
Run Code Online (Sandbox Code Playgroud)

...但是,评论和费率仍属于美国商店,是否有可能获得全球费率和评论的摘要?

其次,我可以更改定义的结果排序sortBy=mostRecent吗?

我的第三个问题是,如果我使用Apple的官方API开发一个监控评论和评级的应用程序,Apple会因为抓取他们的网站或其他类似的原因而拒绝我的应用吗?

json itunes ios

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