草庐IT

Super-Resolution

全部标签

ios - 调用超方法时跳过父类(super class)?

这可能看起来很奇怪,但我想做以下事情:A级-(void)someMethod;B类:A-(void)someMethod;//overridesC类:B-(void)someMethod;//overrides在C类中,我想覆盖两个父类(superclass)中存在的方法,但在[supermethodName]调用中仅调用A类的方法。-(void)someMethod{[supersomeMethod];//butIwanttocallclassA,notB}可能吗? 最佳答案 像这样的东西应该可以工作://inClassC:#im

ios - ARC 项目中的 "Missing [super dealloc]"警告

我已经将一个项目重构为ARC。看起来不错,但是有一个对象使用了通知中心。我在自定义dealloc方法中删除了观察者。这在非ARC项目中运行良好。它也适用于ARC,但我收到一个疯狂的警告:“方法可能缺少[superdealloc]调用。”在ARC项目中,当方法结束时,它会自动为我完成。更好的是:我不能在ARC项目中调用它!这一定是XCode的错误,对吧?这是我的代码:-(void)dealloc{[[NSNotificationCenterdefaultCenter]removeObserver:self];//[superdealloc];willbecalledautomatical

ios - 使用 Masonry 在它的 super View 中居中 View

我正在尝试为iOS使用Masonry。我有一个标签和一个View。我想将标签添加到View中并在View中水平居中。但是,我使用砌体创建的约束无法正常工作。UILabel*a=[UILabelnew];a.text=@"Hi";a.textColor=[UIColorblackColor];[asizeToFit];UIView*b=[UIViewnew];b.frame=CGRectMake(0,0,CGRectGetWidth(a.frame)+18.0f,19.0f);[baddSubview:a];[amas_makeConstraints:^(MASConstraintMak

ios - warning "Class implementation may not have super class"的含义

我创建了一个非常基本的Objective-C类。我的类.h@interfaceMyClass:NSObject@endMyClass.m#import"MyClass.h"@interfaceMyClass()@end@implementationMyClass:NSObject{NSMutableArray*_myArray;}@endXcode在@implementation行显示以下警告:Classimplementationmaynothavesuperclass如果我删除NSMutableArray*_myArray;行,警告就会消失。这个警告是什么意思?我做错了什么?

iphone - 当我初始化自定义单元格时返回 'self' 而它没有设置为 '[(super or self) init...]' 的结果

在CustomCell.m中,我定义了我想从IB加载单元格的init方法:-(id)init{self=[superinit];if(self){NSArray*nib=[[NSBundlemainBundle]loadNibNamed:@"CustomCell"owner:selfoptions:nil];self=[nibobjectAtIndex:0];}returnself;}在MyTableViewController.m的cellForRowAtIndexPath方法中,我初始化了我的自定义单元格-(UITableViewCell*)tableView:(UITableVi

ios - 在 Xcode 6 中对 super View 的边缘进行水平布局时,如何摆脱 -16?

当您尝试在Xcode6Storyboard中将View布局到其superView的边缘时,生成的约束常量为-16。为什么会这样,我怎样才能让它回到0? 最佳答案 -16是因为约束是针对Superview.trailing/leadingMargin而不是父View的边缘设置的。您可以通过选择约束来解决此问题,并在右上角的信息中选择superView项目的下拉菜单并将relativetomargin切换为关闭。 关于ios-在Xcode6中对superView的边缘进行水平布局时,如何摆脱

iOS,在 Objective C 中使用结构,结构值不可从 super View 分配

可以这么说,我正在尝试使用结构将三个值存储为一个单元。我收到一个错误:“Expressionnotassignable”当我尝试从对象的superView中为结构的值赋值时。谁知道这是为什么?在我类(class)的.h文件中,我定义了结构和属性@interfaceMyClass:UIView{structcustomStruct{floata;floatb;floatc;};}@property(assign,nonatomic)structcustomStructmyStruct;在superView中,我尝试分配一个值,但出现错误:“Expressionnotassignable”

iphone - 什么时候调用 viewWillAppear、viewDidDisappear 等中的 super 方法...?

在UIViewController'sdocumentation,Apple建议在viewWillAppear,viewDidAppear,viewWillDisappear,viewDidDisappear等实现中的某个时刻调用super...比如viewDidDisappear的讨论是:Youcanoverridethismethodtoperformadditionaltasksassociatedwithdismissingorhidingtheview.Ifyouoverridethismethod,youmustcallsuperatsomepointinyourimple

ios - 将 __attribute__((objc_requires_super)) 与协议(protocol)一起使用

我有这样的东西:@protocolMyProtocol-(void)oneMethod;@end.@interfaceBaseClassWithProtocol:NSObject@end.@interfaceChildClassWithProtocol:BaseClassWithProtocol@endBaseClassWithProtocol已实现oneMethod,如果ChildClassWithProtocol未在其oneMethod实现。但是我不知道应该在哪里写__attribute__((objc_requires_super))。不支持在protocol中写入它,而在.h中

iphone - Objective-C 中的 "super"是什么? ( self != super )?

我已阅读下面的问题,故事SEEMS很简单:WhatexactlyissuperinObjective-C?还...-(id)init{NSLog(@"self=%p,super=%p",self,super);}打印出“self=0xa83dc50,super=0xbfffe8d0”。地址不一样???!?!?第二个地址似乎是一个“特殊值”之类的东西。什么意思?感谢bbum指出这个值是编译器用来实现“super”行为的特殊结构的堆栈地址。我可以调用[superinit]并且调用似乎有效,或者至少没有爆炸……不会立即发生。调用[((id)0xbfffe8d0)init]失败并返回EXC_B