小编jon*_*ypz的帖子

如何创建testflight邀请代码?

我是一名注册的iOS开发人员,我的开发人员朋友正试图向我发送一个testflight版本.出于某种原因,他无法向我发送邀请 - 我相信这是因为我已注册为开发人员并使用我唯一的苹果ID进行开发苹果帐户注册.
不过,我目前正在测试另一个应用程序...所以有些奇怪的事情......此外,我注意到testflight应用程序底部有一个"Redeem"按钮,所以应该有一个地方邀请其他用户使用邀请码.

那么如何发送testflight邀请码呢?如果无法做到这一点,我该如何解决这个问题?

ios testflight

46
推荐指数
1
解决办法
12万
查看次数

如何强制uitableview调整单元格大小(停用高度约束后)?

我试图UITableViewCell通过点击按钮来扩展.

我正在使用约束来强制动态UITextView告诉UITableViewCell它的新高度.(使用自动布局和UITableViewAutomaticDimension)

没有按钮,这可以正常工作:高度UITableViewCell取决于UITextView高度.

UITextView对最大化单元格大小有一个约束,当点击按钮(单元格折叠)时,我想删除高度约束UITextView(限制单元格高度)并相应地更新单元格.这是扩展方法:

-(void)extendCellWasTapped:(UITableViewCell*)senderCell{

    MAFollowingPostTableViewCell *cell = (MAFollowingPostTableViewCell*)senderCell;

    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];

    if (![self.arrayExtendedTitlesAtIndexPaths containsObject:indexPath]) {
        [self.arrayExtendedTitlesAtIndexPaths addObject:indexPath];
    }

    if ([self.tableView.indexPathsForVisibleRows containsObject:indexPath] ) {
        dispatch_async(dispatch_get_main_queue(), ^(void){

            [NSLayoutConstraint deactivateConstraints:@[cell.constraintTextViewHeight]];

           // CGPoint offset = self.tableView.contentOffset;

            [self.tableView beginUpdates];
            [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
            [self.tableView endUpdates];

// I would like to minimize the animations as well here.. but thats another //problem
//            [self.tableView.layer removeAllAnimations];
//            [self.tableView setContentOffset:offset animated:NO];
// …
Run Code Online (Sandbox Code Playgroud)

uitableview ios autolayout nslayoutconstraint

11
推荐指数
2
解决办法
3304
查看次数

在uiwebview中播放youtube视频.如何处理"完成"按钮?

我有一个播放youtube视频的uiwebview.如何处理完成按钮操作?现在,当我点击完成按钮时,它会更改回我的应用程序主菜单(而不是应该关闭的菜单),它就会冻结.有人可以帮我吗?

Ps:uiwebview所在的菜单,以前是以模态方式呈现的.

youtube iphone video uiwebview ios

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

如何通过uiactivityviewcontroller分享不同的网址?

我正在尝试使用UIActivityViewController为每个项目共享不同的URL.例如,对于twitter:www.google.com; 对于Facebook:www.bing.com

我知道我可以为每个人自定义文本,但我似乎无法找到为每个人自定义网址的方法.

我已经尝试了子类化UIActivityItemProvider,但它没有成功:

文件.m

- (id)initWithText:(NSString *)text{

if ((self = [super initWithPlaceholderItem:text])) {
    self.text = text ?: @"";
    self.url = @"";
}
    return self;
}

- (id)item {
    NSString *activityType = self.activityType;

    if ([self.placeholderItem isKindOfClass:[NSString class]]) {

        if ([self.activityType isEqualToString:UIActivityTypePostToFacebook]) {

            self.url = kSHARELINK_FB;

        } else if ([activityType isEqualToString:UIActivityTypePostToTwitter]) {

            self.url = kSHARELINK_TWITTER;


        } else if ([activityType isEqualToString:UIActivityTypeMessage]) {

            self.url = kSHARELINK_SMS;


            } else if([activityType 

isEqualToString:UIActivityTypeMail]){
            self.url = kSHARELINK_EMAIL;


        }else if ([activityType 

isEqualToString:UIActivityTypePostToWeibo]){
            self.url = kSHARELINK_WEIBO;

        }else{

            self.url = …
Run Code Online (Sandbox Code Playgroud)

xcode analytics share ios uiactivityviewcontroller

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

UICollectionView Section Header坚持某个Y.

我试图复制一个场景,我有一个集合视图一直到顶部,标题视图在集合视图的第一行的顶部,然后标题部分视图(对于indexPath.section == 1),坚持到标题视图没有重叠或在它下面.

我已经实现了一个自定义布局,使标题变得粘稠.但是我不能让它坚持标题视图(所以在它的'origin.y + height之后),它会粘在集合视图的顶部.

这是我的IB结构:

在此输入图像描述

与自定义布局链接:

在此输入图像描述

这是理想的情景:

滚动前:

在此输入图像描述

滚动后:

在此输入图像描述

这是我的代码:

    @implementation LLCollectionCustomFlowLayout

- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
{
    return YES;
}

- (NSArray *) layoutAttributesForElementsInRect:(CGRect)rect {

    NSMutableArray *answer = [[super layoutAttributesForElementsInRect:rect] mutableCopy];

    NSMutableIndexSet *missingSections = [NSMutableIndexSet indexSet];
    for (NSUInteger idx=0; idx<[answer count]; idx++) {
        UICollectionViewLayoutAttributes *layoutAttributes = answer[idx];

        if (layoutAttributes.representedElementCategory == UICollectionElementCategoryCell) {
            [missingSections addIndex:layoutAttributes.indexPath.section];  // remember that we need to layout header for this section
        }
        if ([layoutAttributes.representedElementKind isEqualToString:UICollectionElementKindSectionHeader]) {
            [answer removeObjectAtIndex:idx];  // remove layout of header done by our …
Run Code Online (Sandbox Code Playgroud)

objective-c ios uicollectionview uicollectionviewlayout

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

使用webview在iphone应用程序中播放来自youtube的视频

我正在尝试使用以下代码在我的iphone应用中观看视频:

-(void) viewDidLoad{
[super viewDidLoad];

UIWebView *webView = [[UIWebView alloc]initWithFrame:self.view.frame];

    NSString *youTubeVideoHTML = @"<html><head>\
    <body style=\"margin:0\">\
    <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
    width=\"%0.0f\" height=\"%0.0f\"></embed>\
    </body></html>";

    // Populate HTML with the URL and requested frame size
    NSString *html = [NSString stringWithFormat:youTubeVideoHTML,@"http://www.youtube.com/watch?v=ZiIcqZoQQwg" , 100, 100];

    // Load the html into the webview
    [webView loadHTMLString:html baseURL:nil];
    [self.view addSubview:webView];
}
Run Code Online (Sandbox Code Playgroud)

谁能告诉我我做错了什么?我在几个例子中看过这个,但我仍然无法解决这个问题!

youtube iphone video uiwebview ios

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

使用HJCacheClasses错误缓存图像

我正在使用HJCachelib来缓存我的iPhone应用程序中的图像.

我收到以下错误,但不是所有图像,只是第一个(不)出现.

HJMOFileCache 无法将加载文件移动到就绪文件 /Users/joao__garcia/.../Library/Caches/imgcache/ready/http:__uni.....jpg

加载以下图像没有问题.有人知道发生了什么事吗?

我这样得到目录:

    objMan = [[HJObjManager alloc] init];
    NSString* cacheDirectory = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/imgcache"] ;
    HJMOFileCache* fileCache = [[HJMOFileCache alloc] initWithRootPath:cacheDirectory];
    objMan.fileCache = fileCache;
Run Code Online (Sandbox Code Playgroud)

然后:

managedImage = [[HJManagedImageV alloc] initWithFrame:CGRectMake(96, 88, 185, 167)];

managedImage.url = [NSURL URLWithString:[NSString stringWithFormat:@"http:...",video.thumb_video]];
NSLog(@"%@", managedImage.url);

[objMan manage:managedImage];

//    [objMan performSelectorOnMainThread:@selector(manage:) withObject:managedImage waitUntilDone:YES];
NSLog(@"image %@", managedImage.image);
[managedImage sizeToFit];
playVideoViewButton.backgroundColor = [UIColor colorWithPatternImage:managedImage.image];
Run Code Online (Sandbox Code Playgroud)

iphone caching image-caching

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

如何使用AVAssetExportSession导出AVPlayer音频mp3文件?

我现在正在尝试导出一个使用AVPlayer(使用URL)播放器的mp3文件,因此不必下载两次.

这是我的示例代码:

我已经尝试过每个outputFileType ......

    self.exporter = [[AVAssetExportSession alloc] initWithAsset:self.asset presetName:AVAssetExportPresetPassthrough];
        }

        NSError *error;

        NSLog(@"export.supportedFileTypes : %@",self.exporter.supportedFileTypes);
       //        "com.apple.quicktime-movie",
//        "com.apple.m4a-audio",
//        "public.mpeg-4",
//        "com.apple.m4v-video",
//        "public.3gpp",
//        "org.3gpp.adaptive-multi-rate-audio",
//        "com.microsoft.waveform-audio",
//        "public.aiff-audio",
//        "public.aifc-audio",
//        "com.apple.coreaudio-format"

        self.exporter.outputFileType = @"public.aiff-audio";
        self.exporter.shouldOptimizeForNetworkUse = YES;

        NSURL *a = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:&error];

        NSURL *url = [a URLByAppendingPathComponent:@"filename.mp3"];

        NSString *filePath = [url absoluteString];

        self.exporter.outputURL = url;

        if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]){
            [self.exporter exportAsynchronouslyWithCompletionHandler:^{

                if (self.exporter.status == AVAssetExportSessionStatusCompleted)
                {

                    if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]){ …
Run Code Online (Sandbox Code Playgroud)

audio mp3 ios avplayer avassetexportsession

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

用户类型未定义工作表 VBA

我尝试添加对我的项目的引用,以便解决此错误,但没有成功。

谁能告诉我应该添加哪些库?

Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim ws As Worksheet

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set ws = Worksheets.Add

 'Get the folder object associated with the directory
Set objFolder = objFSO.GetFolder("C:\")
ws.Cells(1, 1).Value = "The files found in " & objFolder.Name & "are:"

 'Loop through the Files collection
For Each objFile In objFolder.Files
    ws.Cells(ws.UsedRange.Rows.Count + 1, 1).Value = objFile.Name
    MyFile = objFile.Name
      NewName = getNewFileName()
Run Code Online (Sandbox Code Playgroud)

excel vba ms-word

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

如何将自定义透明MKAnnotation添加到MKMapView?

所以我试图复制以下场景(半透明注释视图):

在此输入图像描述

我尝试了以下实现失败:

1-创建具有30%不透明度的自定义图像并添加到地图--->结果:图像保持不透明.

码:

-(id)initWithAnnotation:(id<MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier{

self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
if (self) {

    LLAnnotation *myA = (LLAnnotation*) annotation;

    self.accessibilityLabel = myA.title;
    self.annotation = myA;
    self.enabled = YES;
    self.canShowCallout = YES;

    self.centerOffset = CGPointMake(5,-10);

    self.backgroundColor = [UIColor yellowColor];

    self.image = [UIImage imageNamed:@"circle"];
}

return self;
Run Code Online (Sandbox Code Playgroud)

}`

然后将其添加到 - (MKAnnotationView*)mapView:(MKMapView*)mapView viewForAnnotation:(id)annotation_

2-将子图层添加到AnnotationView并清除它--->结果:不显示任何注释.

码:

    - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation_
{

    if (annotation_ == mapView.userLocation) return nil;

    MKAnnotationView *m = [[MKAnnotationView alloc] initWithAnnotation:annotation_ reuseIdentifier:@"default"];

//    m.backgroundColor = [UIColor clearColor];

    CALayer *layer …
Run Code Online (Sandbox Code Playgroud)

iphone calayer mkmapview mkannotationview ios

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