草庐IT

self-register

全部标签

objective-c - 有没有办法从应用程序本身到 'self-destruct'?

我想要从内部卸载应用程序的能力。示例:弹出UIAlertView并提示“此应用程序已过期”。用户点击“确定”,然后应用程序继续关闭并将其自身从设备中删除。有什么办法吗? 最佳答案 我认为没有办法从手机本身删除该应用程序。但是,您可以使用代码终止应用程序的执行,exit(0);也不鼓励这样做,因为您不应该在用户不知情的情况下突然退出应用程序。但是,如果您显示警报并退出该应用程序,那没关系,并且确实有必要退出该应用程序。 关于objective-c-有没有办法从应用程序本身到'self-de

ios - 尝试创建 iOS 应用程序存档时出错 : "Unable to create a provisioning profile because your team has no devices registered."

我正在尝试使用Xcode创建一个iOS应用程序的存档,以将其提交到AppStore。但是,当我选择“iOSDevice”作为目标并单击Product-Archive时,会弹出以下错误消息:UnabletocreateaprovisioningprofilebecauseyourteamhasnodevicesregisteredintheMemberCenter.Pleaseconnectadevice,enableitfordevelopment,andaddittotheMemberCenterusingtheOrganizer.当我在应用程序设置页面上单击“修复问题”按钮时,也会

ios - 在 block 中使用局部变量名称 "self"是否正确?

我发现构造__strongtypeof(self)self=weakSelf。它允许删除NSAssert宏self捕获,但我怀疑以这种方式使用它是否正确?__weaktypeof(self)weakSelf=self;self.signupBlock=^{__strongtypeof(self)self=weakSelf;NSLog(@"%d",self.property)NSAssert((self.property>5),@"Somemessage");}请多多指教。对不起,我不得不先说使用__strongtypeof(self)strongSelf=weakSelf;构造结果以w

ios - self.viewController.webView stringByEvaluatingJavaScriptFromString 不起作用

NSString*jsString=[NSStringstringWithFormat:@"alert('ok');"];[self.viewController.webViewstringByEvaluatingJavaScriptFromString:jsString];我在cordovaappdelegate.m中写的! 最佳答案 在cordova-ios@3.x上你应该能够做到:[self.webViewstringByEvaluatingJavaScriptFromString:jsString];在cordova-ios

iphone - 当 App 进入前台时调用 self.viewDidAppear

我想让我的应用在用户将应用带到前台时再次调用viewDidAppear。-(void)appReturnsActive{//THISISTHEBITTHATDOESNTWORK,BUT[self.viewDidLoad]DOESWORK[self.viewDidAppear];}我正在像这样在我的viewDidAppear方法中创建appReturnsActive。它运作良好:[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(appReturnsActive)name:UIApplication

ios - self 弱的 NSTimer;为什么不调用 dealloc?

考虑具有强(或弱,相同)NSTimer属性的ViewController:__weak__typeof(self)ws=self;self.timer=[NSTimerscheduledTimerWithTimeInterval:2target:wsselector:@selector(timerTigger:)userInfo:nilrepeats:YES];但为什么这个ViewController不调用dealloc方法,无论我通过strong还是weak引用到self?详细代码如下:#import"SecondViewController.h"@interfaceSecondVi

ios - 积木中的弱势 self

我是否需要检查block中的weakself是否为nil?我像这样创建weakSelf指针:__weaktypeof(self)weakSelf=self;在我做的block的开头if(!weakSelf){return;}这是不必要的吗?还是取决于我是否正确编码其余部分,以便当self死亡时,其他人也会死亡? 最佳答案 这种检查是不必要的,会给你一种错误的安全感。问题是:__weaktypeof(self)weakSelf=self;dispatch_async(dispatch_get_main_queue(),^{if(!we

ios - self.navigationController.tabBarController.selectedIndex 不工作

我有一个UITabBarController,它包含4个不同的UIViewControllers。在第一个选项卡上有一个UINavigationViewController,它包含它的子UIViewController。在不点击标签栏的情况下,我想将用户带到第二个标签上。为此,我尝试了:self.navigationController.tabBarController.selectedIndex=1;但它不起作用。忽略任何错误,我是新手。谢谢。 最佳答案 如果设置委托(delegate)试试这个:self.selectedInde

ios - 有没有办法在 iOS 中使用表格 View 设计类似 Tinder/Twitter-self-profile 的标题效果?

我正在尝试设计类似于在Tinder和Twitter自己的个人资料View上看到的东西。在Tinder上,用户自己的个人资料图片后面有一个模糊的背景,当向下滑动时,View会变大并逐渐模糊,最终到达用户的个人资料View(在Twitter上,它开始清晰,随着它变大而模糊,导致Twitter帐户选择View)。我最近在许多应用程序中看到了这种特殊效果,我也想将它包含在我的应用程序中。这种效果/手势有名字吗?有没有一种简单的方法可以使用标准表格View来实现它,还是我应该开始对其进行硬编码? 最佳答案 作为练习,我尝试在以下项目中重现Tw

ios - 用新的 UIView 替换 self.view 显示黑色 View

我想将UIViewController中的现有View更改为新View。新View包含旧View和一个小横幅View。做这个相当简单的改变给我留下了一个黑色的View。我的代码是这样的UIView*existingView=self.view;UIView*newView=[[UIViewalloc]initWithFrame:existingView.frame];UIView*bannerView=[[UIViewalloc]initWithFrame:CGRectMake(0,(self.view.frame.size.height-50),320,50)];CGRectexis