我正在尝试获取所有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)
谢谢.
因为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)
谢谢你们的帮助.
我想实现iOS6的新ActivityViewController,但我想摆脱未使用的活动,如消息,复制,在微博上分享等.
是否可以自定义或子类化以删除这些图标?
谢谢你的帮助!
我的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 =红色).有任何想法如何获得折线的渐变?(高色,中心色,低色)
感谢大家.
我正在寻找答案,但尚未找到答案,所以:
例如:我有一个像"#blablub"的字符串,我想在开头删除#,我只需删除第一个字符.但是,如果我有一个带有"##### bla #blub"的字符串,我只想在第一个字符串的开头删除所有#,我不知道如何解决这个问题.
我的目标是获得像这样的"bla#blub"这样的字符串,否则使用replaceOccourencies会很容易...
我希望你能提供帮助.
正如话题已经说过的那样,我尝试在我的UIKeyboard外观上创建一个小线.原因是,如果我在白色背景下弹出白色键盘,它看起来很糟糕.
一个想法是创建一个薄的1px线并将其放在底部,隐藏它并在显示键盘时显示它并将其与自动布局对齐.这个想法的缺点是在每个视图中都这样做.
谢谢你的想法.
ios ×4
objective-c ×4
ios6 ×2
swift ×2
autolayout ×1
calayer ×1
character ×1
facebook ×1
rotation ×1
sinaweibo ×1
string ×1
uikeyboard ×1
weibo ×1