我想知道本地玩家的真实姓名,但GKLocalPlayer的displayName返回"Me",而不是真实姓名.
编码我使用的:
void (^completitionHandler)(NSArray *, NSError *) = ^(NSArray *players, NSError *error) {
for (GKPlayer *p in players) {
NSString *alies = p.alies;
NSString *name = p.displayName;
NSLog(@"name = %@",name); //not real name, just "Me"
}
}
Run Code Online (Sandbox Code Playgroud) iOS-app最小化时如何从相机拍照?
(即applicationDidEnterBackground:/ 之后applicationWillResignActive:)
AppDelegate.m: (感谢你链接)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//To make the code block asynchronous
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//### background task starts
NSLog(@"Running in the background\n");
while(TRUE)
{
printf("Called"); //////Work fine
[self.window.rootViewController captureNow]; /////Capture picture!
[NSThread sleepForTimeInterval: 10.0]; //wait for 10 sec
}
});
return YES;
}
Run Code Online (Sandbox Code Playgroud)
OurViewController.m: (感谢你链接)
-(IBAction)captureNow {
AVCaptureConnection *videoConnection = nil;
for (AVCaptureConnection *connection in _stillImageOutput.connections)
{
for (AVCaptureInputPort *port in [connection inputPorts])
{
if ([[port …Run Code Online (Sandbox Code Playgroud) 我们希望在iOS 5+应用中使用iOS 7字体.
我们试试这个:
UIFont *font = [UIFont fontWithName:@"Helvetica Neue Ultra Light" size:50];
Run Code Online (Sandbox Code Playgroud)
要么
UIFont *font = [UIFont fontWithName:@"Helvetica-Neue-Ultra-Light" size:50];
Run Code Online (Sandbox Code Playgroud)
但是字体是(null).
那么,如何使用iOS 7字体?