草庐IT

instance_double

全部标签

ios - 将字符串百分比转换为 double

我想将数组中的字符串百分比转换为double。显然,我必须同时删除百分比,然后按照[stringdoubleValue]的方式做一些事情。删除%的最有效方法是什么?该操作经常重复,因此该方法必须在某种程度上节约资源。 最佳答案 只要您的字符串以float的有效文本表示形式开头(它只能在开头包含空格),您就可以调用doubleValue并忽略对字符串的任何预处理。NSLog(@"value:%f",[@"95.5%"doubleValue]);//-->value:95.500000 关于

ios - [MyClassName copyWithZone :]: unrecognized selector sent to instance?

我刚刚实现了我的类(class)@interfaceExampleNestedTablesViewController(){NSMutableArray*projectModelArray;NSMutableDictionary*sectionContentDictionary;}-(void)viewDidLoad{[superviewDidLoad];ProjectModel*project1=[[ProjectModelalloc]init];project1.projectName=@"Project1";ProjectModel*project2=[[ProjectModel

ios - 编译时错误 : No known instance method for selector 'setDetailItem:'

在Xcode5.0.2中,我为iPhone创建了一个空白的Detail-Master应用。然后在Main.storyboard中,我将UILabel替换为UIWebView,并在DetailViewController.h中将其声明为webView.我还用NSDictionary*dict替换了id*defaultItem:#import@interfaceDetailViewController:UIViewController@property(strong,nonatomic)NSDictionary*dict;@property(weak,nonatomic)IBOutletU

ios - [UITableViewCell nameLabel] : unrecognized selector sent to instance

我想知道有没有人知道如何解决这个问题?***Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'-[UITableViewCellnameLabel]:unrecognizedselectorsenttoinstance0x7fa9ca4936c0'我的代码是:(UITableViewCell*)tableView:(UITableView*)foldertableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{staticNSString*

ios - [ViewController gestureRecognizer :shouldRecognizeSimultaneouslyWithGestureRecognizer:]: message sent to deallocated instance

我有一个简单的场景。我将myViewController插入导航堆栈。myViewController基本上是在整个屏幕上显示一个CollectionView。我在此CollectionView上添加了一个额外的UIPanGestureRecognizer并将myViewController设置为其委托(delegate)。我在myViewController中保留了对平移手势识别器的强烈引用。当我点击返回时,myViewController从导航堆栈中弹出并释放。myViewController的dealloc方法被正确调用。到目前为止,一切都按预期工作。然后我尝试像第一次一样打开相

iphone - 指针指向不同的对象 : (Unrecognized selector sent to instance)

当我尝试在我的对象pageModel上调用此函数时,我的应用程序发生了奇怪的崩溃[pageModelpageTitle]isEqualToString:@"sometext"];这是调试器转储-[__NSArrayMisEqualToString:]:unrecognizedselectorsenttoinstance0x661de40***Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'-[__NSArrayMisEqualToString:]:unrecognizedselectors

iphone - "unrecognized selector sent to instance"键盘出现时

当我在我的应用程序屏幕中单击一个文本字段并且键盘出现时,xcode调试器显示此错误:[mainViewControllerkeyboardWasShown]:unrecognizedselectorsenttoinstance0x5867ac0在mainViewController的viewDidLoad方法中,我这样调用registerForKeyboardNotifications方法:[自行注册键盘通知];这是它的实现(在mainViewController.m中):-(void)registerForKeyboardNotifications{[[NSNotificationC

ios - [__NSCFString objectForKey :]: unrecognized selector sent to instance

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭8年前。Improvethisquestion我在这里遇到这个错误+(CGFloat)heightForViewWithObject:(id)objectinColumnWidth:(CGFloat)columnWidth{NSString*titleText=[objectobjectForKey

objective-c - 在 iOS 上,当您将 double 传递给需要 [单个] float 作为参数的方法时,实际发生了什么?

假设我有一个函数:-(void)doSomethingWithFloat:(float)aFloat;我用double浮点值调用该函数,如下所示:[selfdoSomethingWithFloat:12.0];从12.0(double)到12.0f(单精度)的转换是在编译时或运行时完成的,还是两者都不是?只是为了清楚起见:我不是在问单精度和double之间的区别精度float。 最佳答案 ObjectiveC实际上遵循大部分C约定-因此当传递给函数时,float根据C规范被提升为double值。ObjectiveC编译器最终将所有方

c# - 单点触控 : Doubling Appearance Image size when Hue adjusted on Retina display

我正在使用此代码设置NavBar的背景,该代码在Retina和非Retina显示器中效果很好。有一个@2x和正常图像。所以,一切都很好:UINavigationBar.Appearance.SetBackgroundImage(GetImage(ImageTheme.menubar),UIBarMetrics.Default);现在,当我将此ChangeHue()变换应用到图像以调整其色调时,在Retina显示器上图像大小是原来的两倍。非Retina显示器也可以:UINavigationBar.Appearance.SetBackgroundImage(ChangeHue(GetIma