Tag: 目标C

无法使用Google地图API(GMSMapView)获取当前位置

我尝试使用Google Map API从当前位置到另一个位置的方向。 当我手动input原点和目标点时,一切正常。 但是,当我尝试将原点设置为当前位置时,位置为下面的代码为空: mainMap=[[GMSMapView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)]; GMSCameraPosition *camera = [GMSCameraPosition cameraWithTarget:[mainMap.myLocation coordinate] zoom:13]; mainMap.camera=camera; mainMap.myLocationEnabled=YES; // <—- The blue point appear on map: it's exactly my location [self.view addSubview:mainMap]; //Get mylocation CLLocation *myLocation = mainMap.myLocation; // <—– NULL 有没有人知道我的问题在这里? 很多

JSON匹配NSString与NSDictionary

我试图匹配我从另一个UITableView得到的JSON NSString,在prepareToseg期间与两个JSON包含相同的密钥的nid匹配。 我想要的是,使这个UITableView只显示匹配的NID内容。 我将从第二个UITableView发布2套我的JSON和我的代码。 请帮我出去。 这是myJSON的第一套 [ { node_title: "Fumi", nid: "9", Body: "<p>Fumi Restaurant</p> ", Shop Branch Reference: "8", Shop Enterprise Reference: "<a href="/drupal/node/7">Fumi</a>", Shop Service Time: [ "<div class="time-default"> Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday 10:00am – 8:00pm</div> " ], Shop User Reference: "<a href="/drupal/user/12">suppae</a>" }, { node_title: "Shop Number One", nid: […]

IOS工具栏不显示

我是新来的ios编程。 我遇到的问题是我已经在我的xib文件中设置了一个工具栏,但运行应用程序后,工具栏不显示。 我已经在viewDidLoad函数和delegate.m类中添加了这两行,但仍然没有显示工具栏 self.navigationController.toolbarHidden = NO; 这是我的代码 – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; NSArray *languages = [userDefaults objectForKey:@"AppleLanguages"]; EPubViewController *epubView = [[EPubViewController alloc] init]; [epubView loadEpub:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"AtoZbook" ofType:@"epub"]]]; self.navigationController = [[UINavigationController alloc]initWithRootViewController:epubView]; self.navigationController.toolbarHidden = NO; self.window.rootViewController = self.navigationController; [self.window makeKeyAndVisible]; return YES; } EPubViewController.m – (void)viewDidLoad { [super […]

使用svk v3.19和Graph API v2.1自定义Facebook iOS请求对话框

我试图找出如何在新的Facebook iOS SDK中创build自定义邀请/请求对话框。 到目前为止,我只find使用FBWebDialogs来创build请求对话框,但它不是可定制的AFAIK。 在这个示例中有一个解释如何做到这一点,但它不能帮助我,因为: 这是Java脚本API。 它讨论了invitable_friends API,而“invitable_friends API只适用于使用graphicsAPI 2.0版的Facebook Canvas应用程序实现的游戏”,而我的游戏Thingies仅在iOS中可用。 所以问题是: “请求”对话框(FBWebDialogs)甚至可以用在Facebook Canvas上没有的iOS游戏中吗? 因为这里说的是一个在Facebook Canvas上不存在的应用程序可以使用iOS上的消息对话框,而不是请求对话框,但是在这里它不会将iOS中的FBWebDialogs限制为使用Canvas的游戏(如果它限制了什么当您在2015年4月之后使用FBWebDialogs时发生?exception?!?) 如何在Facebook iOS SDK 3中定制请求对话框? 比如在这里: 你可以在这个对话框中向没有玩游戏的朋友发送请求吗? 当您select并发送请求后,它会打开一个发送请求对话框进行确认吗? 比如在这里: 谢谢你们!

在Singleton中用自己的setter覆盖属性

我有一个类ViewController.m我想要设置我的其他类Singleton.m应该自动保存到NSUserDefaults 。 我认为我必须在Singleton.m读取属性并覆盖setter,但是这是最好的方法吗? 如果是,我该怎么做?

用UIImage和下载的图像进行caching

我有一个类方法,用完成块获取图像。 这个提取的UIImage被添加到一个带有相关密钥的NSCache。 这似乎工作正常,但是,在获取图像的方法,我使用UIImage的imageWithData:方法,我发现不会caching它的数据,只有imageNamed:做。 我可以理解的获取内存警告正因为如此,我怎么确保用UIImage的imageWithData:方法加载的图像不再需要时从内存中删除? 编辑 这里是下载图像的方法的代码。 – (void)imageForFootageSize:(FootageSize)footageSize withCompletionHandler:(void (^)(UIImage *image))completionBlock { if (completionBlock) { __block UIImage *image; // Try getting local image from disk. // __block NSURL *imageURL = [self localURLForFootageSize:footageSize]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ image = [UIImage imageWithData:[NSData dataWithContentsOfURL:imageURL]]; dispatch_async(dispatch_get_main_queue(), ^{ if (image) { completionBlock(image); } else { // // Otherwise try getting remote […]

iOS从本地通知打开页面

我目前使用UNUserNotificationCenter在OS10的指定时间发出本地通知。 我试图找出当用户点击本地通知时如何在我的应用程序中打开特定的页面。 任何人如何做到这一点我真的很新,在C#编程的iOS,我敢肯定它并不罕见的事情要做。

在iOS iOS Xamarin上更改背景

我正在构build一个iOS应用程序,我试图每隔几秒更改背景图片。 我使用这里的代码设置了一个计时器: https : //developer.xamarin.com/api/type/System.Threading.Timer/ 我的代码如下所示: using System; using System.Threading; using UIKit; namespace TestApp { public partial class ViewController : UIViewController { // New Timer class BackgroundTimer { public int counter = 0; public Timer tmr; } // Load screen public override void ViewDidLoad() { base.ViewDidLoad(); BackgroundTimer s = new BackgroundTimer(); // Create the delegate […]

从IntPtr创buildNSException

我指的是这个post : private static void MyUncaughtExceptionHandler(IntPtr exception) { // this is not working because NSException(IntPtr) is a protected constructor var e = new NSException(exception); // … } 我如何在这里创build一个exception? 我应该这样做吗? NSException exception = (NSException)ObjCRuntime.Runtime.GetNSObject(handle);

如何在实现文件的委托中调用所需的方法

我有两个视图控制器VC1和VC2。 我通过prepareForSegue方法将值从VC1传递给VC2。 当我在VC2中收到这个值时,我将它乘以10.然后,在VC2中乘以10后,我想返回到VC1。 为了解决这个问题,我会使用Delegate 。 所以,我创build了DelegateDataProcessor类 但是我不知道如何在方法startProcessingValue调用processingDone完成所需的方法 请看下面的代码 ** DelegateDataProcessor.h **: #import <Foundation/Foundation.h> @protocol ProtocolDataProcessor <NSObject> @required – (void) processingDone; @end @interface DelegateDataProcessor : NSObject{ id <ProtocolDataProcessor> _delegate; } @property (nonatomic, strong) id delegate; -(void) startProcessingValue: (NSInteger) valueToBeProcessed; @end ** DelegateDataProcessor.m **: #import "DelegateDataProcessor.h" @implementation DelegateDataProcessor -(void) startProcessing:(NSInteger) value { value = value * 10; […]