不能完全解雇我以前的alertcontroller

我试图使用一个单一的警报控制器,其中包括多个警报显示function和一个解雇function。但我在我的控制台有这个警告 ,我的其他警报不显示。我想知道为什么?和解决scheme。 这是我的警报控制器 import UIKit class MyAlertViewController: UIViewController { var myAlertController : UIAlertController! override func viewDidLoad() { super.viewDidLoad() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func displayLoadingAlert(viewController: UIViewController?) -> UIAlertController { var controllerToPresent = viewController if controllerToPresent == nil { controllerToPresent = self } //create an […]

点击检测不能在UIImageView上工作

在我的.m文件中我添加了: @property (strong, nonatomic) UIImageView *star1; 然后用我做的一个方法: UIImage *star1Image; star1Image = [UIImage imageNamed:@"staryes"]; self.star1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)]; self.star1.tag = 800; [self.star1 setImage:star1Image]; [ratingLabelBody addSubview:self.star1]; 几行后,没有涉及到我有: [self.star1 setUserInteractionEnabled:YES]; UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imgTouchUp:)]; tapped.numberOfTapsRequired = 1; [self.star1 addGestureRecognizer:tapped]; 最后在我已经实现的.m文件中: -(void)imgTouchUp:(id)sender { NSLog(@"imgTouchUp"); UITapGestureRecognizer *gesture = (UITapGestureRecognizer *)sender; NSLog(@"tap detected on […]

file upload进度问题

我使用AFNetworking在表格视图单元格中上传单个文件。 上传工作正常。 但是,当我从视图中滚动我的单元格时,进度消失了,或者显示了不同的进度值,例如20%或50%,以及30%。 这是我的代码: //Tableview Cell configure var cell : ChattingPhotoCell! if message.vendorType == .Receiver { //Receive Image message cell = tableView.dequeueReusableCell(withIdentifier: "ReceiveChattingPhotoCell") as! ChattingPhotoCell if cell == nil { cell = Bundle.main.loadNibNamed("ReceiveChattingPhotoCell", owner: self, options: nil)?[0] as! ChattingPhotoCell } cell.reloadDelegate = self cell.mDelegate = self cell.accessoryType = cell.isSelected ? .checkmark : .none cell.conficureImageCell(msg: message,indexPath: […]

CGRectMake不能使用UIView

我今天花了几个小时来隐藏PickerView,当我的应用程序被加载,但问题不在于PickerView。 它与CGRectMake。 我尝试了一个简单的项目在Xcode只是为了告诉你,CGRectMake不适合我… 这里是我的故事板(灰色区域是UIView组件): 这是我的界面: #import <UIKit/UIKit.h> @interface ViewController : UIViewController @property (strong, nonatomic) IBOutlet UIView *container; @end 这里是我的实现文件: #import "ViewController.h" @interface ViewController () @end @implementation ViewController – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. _container.frame = CGRectMake(0, 0, 320, 204); } – (void)didReceiveMemoryWarning { […]

推送通知不在后台iOS中接收

我正在通过GCM在我的项目中推送通知。 我的应用程序能够在前台收到通知,但不能在后台收到通知。 我在方法里面收到一条消息 func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) 当应用程序在前台,但我没有得到任何调用的方法 func application( application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler handler: (UIBackgroundFetchResult) -> Void) 当应用程序在后台模式。 我在互联网上search了很长时间,才知道这是我收到的有效载荷格式的问题。 我收到的有效载荷看起来像 [通知:{“body”:“任何东西”,“标题”:“任何标题”},优先级:高,content_available:true,至:kcF23gblKok ….,collapse_key:do_not_collapse,from:7812 ….] 任何人都可以build议我有效载荷的正确格式?

加载视图控制器后,应用程序运行缓慢,然后卸载大约15-20次

使用:Xcode 4.6故事板ARC模型inheritance到SecondViewController 我有一个应用程序,主要的ViewController加载一个新的veiwController时,设备旋转到右侧。 当应用程序启动时,一切都很好。 如果我旋转设备,然后回来卸载第二个视图控制器,约15-20倍的应用程序是非常长老。 我已经缩小了,它只发生在seconed视图控制器加载时,只有当我旋转设备的时间nunmber。 我也缩小了这是一个记忆问题。 我安装了一个应用程序,logging使用和可用的内存。 当我旋转设备多次时,我的记忆从400mb到900mb。 我正在尝试尽可能多地提供信息。 每个视图有8个NSTimers每秒钟触发。 有没有办法编程卸载视图,以确保被卸载? 我已经包含这个代码来确保加载和卸载: ` – (void)setView:(UIView *)aView {NSLog(@“>>> Entering%s <<<”, PRETTY_FUNCTION ); if (!aView) // view is being set to nil { NSLog(@"Should be unloading now"); } [super setView:aView]; NSLog(@"<<< Leaving %s >>>", __PRETTY_FUNCTION__); } 日志结果:2013-04-22 16:42:03.588 xxxxxxxx [xxxxxxx] >>>input – [GraphViewController setView:] <<< 2013-04-22 […]

Pushwhoosh远程通知

我们使用Pushwhoosh进行远程通知。 它的工作正常,但图标徽章计数不增加。 这是代码: – (void) onPushReceived:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart { [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1]; } – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge)]; PushNotificationManager * pushManager = [PushNotificationManager pushManager]; pushManager.delegate = self; if ([launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey]) { PushNotificationManager * pushManager = [PushNotificationManager pushManager]; [pushManager startLocationTracking]; } [[UIApplication […]

更改UILabel中的文本正在导致我所有的imageViews和button回到原来的位置

每当我尝试更改标签文本 _levelNumberLabel.text = [NSString stringWithFormat:@"%i", difficulty]; 它不断移动我的所有标签,图像和button回到原来的位置。 我以前从来没有遇到过这个问题,而且我知道它的这一行代码,因为删除它时不会发生。 有任何想法吗?

我怎样才能在UINavigationBar的右侧设置两个button?

我制作了一个标准的主/从应用程序(使用Xcode模板)。 我修改了它,现在,当我单击第一个表视图的一个单元格时,该应用程序显示了另一个表视图(这是因为被单击的单元格值过滤的细节)。 在标准的表格视图中,我会在UINavigationBar上看到这种情况: Edit Table title + (for adding new items) 我也需要UINavigationBar的默认后退button。 是否有可能并允许这样做? 在graphics上,它会是这样的: < Back Table title Edit + 你知道任何其他布局显示3button(回编辑 – 添加)加标题全部在顶部栏? 对不起,不张贴图片,在此先感谢。 PS我想知道是否有可能通过内置后退button和编辑button(我的意思是系统自动放置在导航栏上)来执行所要求的操作。

使用RestKit进行同步HTTP调用

当将用户login到我的应用程序中时,我需要仅使用用户名从服务器拉下用户对象。 这将返回userId(除其他外),以​​便进行其他API调用。 从那一刻起,我将使用userId进行一些其他的HTTP调用。 在发送其他呼叫之前,如何使同步呼叫完全拉下用户对象? 我已经在我的应用程序委托类中设置了我的对象映射,它完美地工作,并使用此代码从服务器拉下用户对象: [[RKObjectManager sharedManager] loadObjectsAtResourcePath:[@"/api/users/" stringByAppendingString:[_userNameField text]] delegate:self]; 这就是我已经尝试过…这里build议: 使用RestKit进行同步调用 RKObjectLoader* loader = [[RKObjectManager sharedManager] objectLoaderForObject:currentUser method:RKRequestMethodPUT delegate:nil]; RKResponse* response = [loader sendSynchronously]; 然而,这个代码(1)使用了不赞成使用的方法objectLoaderForObject,并且(2)崩溃说'Unable to find a routable path for object of type '(null)' for HTTP Method 'POST'' 。