小编Fry*_*Fry的帖子

iOS Facebook SDK - 获取与App连接的好友列表

我正在尝试获取所有Facebook好友的列表,他们正在使用我正在获取所有朋友列表的应用程序,但是如何过滤所有正在使用该应用程序的朋友?

    FBRequest* friendsRequest = [FBRequest requestForMyFriends];
    [friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,
                                                  NSDictionary* result,
                                                  NSError *error) {
        NSArray* friends = [result objectForKey:@"data"];
        NSLog(@"Found: %i friends", friends.count);
        for (NSDictionary<FBGraphUser>* friend in friends) {
            NSLog(@"I have a friend named %@ with id %@", friend.name, friend.id);

        }
        NSArray *friendIDs = [friends collect:^id(NSDictionary<FBGraphUser>* friend) {
            return friend.id;
        }];

    }];
Run Code Online (Sandbox Code Playgroud)

谢谢.

facebook objective-c ios

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

ios 6应用程序正在旋转,即使使用shouldAutorotate:NO

因为iOS6我的旋转问题很大.我实现了所有新的旋转方法(shouldAutorotate,preferredInterfaceOrientationForPresentation,supportedInterfaceOrientation),但所有视图仍在旋转.有趣的是,视图保持其大小,窗口的其余部分(在风景中)是黑色的.

这就是我实现它的方式,有什么不对吗?

#pragma mark -
#pragma mark - InterfaceOrientation iOS 5 
//Deprecated in iOS 6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark -
#pragma mark - InterfaceOrientation iOS 6

- (BOOL)shouldAutorotate{
    return NO;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return UIInterfaceOrientationPortrait;
}

- (NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskPortraitUpsideDown;
}
Run Code Online (Sandbox Code Playgroud)

谢谢你们的帮助.

objective-c rotation ios6

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

iOS 6 ActivityViewController定制微博等

我想实现iOS6的新ActivityViewController,但我想摆脱未使用的活动,如消息,复制,在微博上分享等.

是否可以自定义或子类化以删除这些图标?

谢谢你的帮助!

objective-c ios6 weibo uiactivityviewcontroller sinaweibo

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

在MKPolyLineView中绘制CAGradient

我的MKPolyLineView只有一个问题.我只是尝试为Polyline创建一个颜色渐变,但是使用CAGradient它会起作用.我将MKPolylineView子类化并重新绘制

- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context

 UIColor *darker = [UIColor blackColor];
    CGFloat baseWidth = self.lineWidth / zoomScale;

    // draw the dark colour thicker
    CGContextAddPath(context, self.path);
    CGContextSetStrokeColorWithColor(context, darker.CGColor);
    CGContextSetLineWidth(context, baseWidth * 1.5);
    CGContextSetLineCap(context, self.lineCap);
    CGContextStrokePath(context);

    // now draw the stroke color with the regular width
    CGContextAddPath(context, self.path);
    CGContextSetStrokeColorWithColor(context, self.strokeColor.CGColor);
    CGContextSetLineWidth(context, baseWidth);
    CGContextSetLineCap(context, self.lineCap);
    CGContextStrokePath(context);

    [super drawMapRect:mapRect zoomScale:zoomScale inContext:context];
}
Run Code Online (Sandbox Code Playgroud)

但即使这样也行不通(StrokeColor =红色).有任何想法如何获得折线的渐变?(高色,中心色,低色)

感谢大家.

objective-c calayer ios cagradientlayer

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

Swift:仅在开头删除字符串的特定字符

我正在寻找答案,但尚未找到答案,所以:

例如:我有一个像"#blablub"的字符串,我想在开头删除#,我只需删除第一个字符.但是,如果我有一个带有"##### bla #blub"的字符串,我只想在第一个字符串的开头删除所有#,我不知道如何解决这个问题.

我的目标是获得像这样的"bla#blub"这样的字符串,否则使用replaceOccourencies会很容易...

我希望你能提供帮助.

string character ios swift

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

Swift:在iOS中显示键盘的顶部创建边框或细线

正如话题已经说过的那样,我尝试在我的UIKeyboard外观上创建一个小线.原因是,如果我在白色背景下弹出白色键盘,它看起来很糟糕.

一个想法是创建一个薄的1px线并将其放在底部,隐藏它并在显示键盘时显示它并将其与自动布局对齐.这个想法的缺点是在每个视图中都这样做.

谢谢你的想法.

uikeyboard ios autolayout swift

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