Tag: xib

由于XCode 6.3 – > Nib无法加载

我今天更新了我的XCode从6.2到6.3。 我适应了所有的迅速变化,但是当我运行的应用程序,我得到每个NIB的错误,我尝试加载了~ipad或~iphone 。 (NIB无法加载) 没有那个设备修饰符的笔尖像往常一样加载。 如果我删除~iphone或~ipad ,可以再次find笔尖,但显然这是没有解决scheme,因为它是一个通用的应用程序。 每个其他文件types也是如此,我尝试通过代码加载例如故事板。

将约束添加到xib中的“主视图”

我有一个.xib文件中定义的UIView 。 我需要设置translatesAutoresizingMaskIntoConstraints = NO 。 这意味着框架不会被转换为约束,所以我需要自己设置大小约束。 我为UIView创build了一个工作类别的方法: -(NSArray*)setSizeConstraints:(CGSize)size { NSLayoutConstraint* height = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeHeight relatedBy:0 toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:size.height]; NSLayoutConstraint* width = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeWidth relatedBy:0 toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:size.width]; [self addConstraint:height]; [self addConstraint:width]; return [NSArray arrayWithObjects:height, width, nil]; } 但是我想从Xcode接口生成器中设置这些约束,但是我所有的AutoLayout控件都是灰色的: 有没有办法在界面生成器中做到这一点?

Xcode故事板 – ibtoold取消存档exception

例外是; CompileStoryboard Catwall/en.lproj/MainStoryboard.storyboard cd /Users/guvenozyurt/Desktop/git/catwall_ios setenv IBSC_MINIMUM_COMPATIBILITY_VERSION 5.1 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" setenv XCODE_DEVELOPER_USR_PATH /Applications/Xcode.app/Contents/Developer/usr/bin/.. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ibtool –errors –warnings –notices –output-format human-readable-text –compile /Users/guvenozyurt/Library/Developer/Xcode/DerivedData/Catwall-ghvlotdrbpzsfveimvmoxitsgpod/Build/Products/Debug-iphonesimulator/Catwall.app/en.lproj/MainStoryboard.storyboardc /Users/guvenozyurt/Desktop/git/catwall_ios/Catwall/en.lproj/MainStoryboard.storyboard –sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk 2013-03-07 17:14:26.187 ibtoold[34122:707] Exception raised while unarchiving document objects – *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil/* com.apple.ibtool.errors *//Users/guvenozyurt/Desktop/git/catwall_ios/Catwall/en.lproj/MainStoryboard.storyboard: error: The document "MainStoryboard.storyboard" could not be opened. The operation couldn't […]

将自定义视图添加到警报视图

我有这样的问题: 我想在一个警报视图中显示一个自定义的视图。 所以我创build了一个单独的xib文件,并devise了我的界面,并为它实现了类。但是当我应用下面的代码时,它给了我一个错误。 这是代码: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Confirm your Action" message:@"Click OK to confirm" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Cancel",nil]; NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"customDialogViewController" owner:self options:nil]; customDialogViewController *myView = (customDialogViewController*) [subviewArray objectAtIndex:0]; [alert setValue:myView forKey:@"accessoryView"]; //alert.alertViewStyle = UIAlertViewStylePlainTextInput; alert.tag = KAlertViewthree; [alert show]; 这是我的错误: Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view […]

iOS7 XIB问题。 顶部和底部的空白空间

我正在设置一个ImageView的视图。 自动布局被选中。 它在预览中看起来不错,但是当应用程序实际在模拟器上运行时,仅在iPHone视网膜4英寸模拟器的顶部和底部才会显示空白区域。 在3.5英寸看起来不错。 使用iOS7和XCODE 5。 即使我从视图中删除图像,仍然有同样的问题。 什么可以是这个空白的理由?

使用自定义的initWithCoder初始化视图

为了初始化具有xib的视图,我使用了initWithCoder函数。 但是如果我需要用自定义参数初始化xib呢? 我需要这样的东西: – (id)initWithCoder:(NSCoder *)aDecoder andTitle:(NSString *)titleString { self = [super initWithCoder:aDecoder]; if (self) { self.titleLabel = titleString; } return self; } 我什么时候打电话? 在awakeFromNib之后?

从笔尖实例化视图会引发错误

我尝试在这个( 链接 )教程之后创build@IBDesignable UIView子类。 第一个自定义视图很好。 但是当我尝试做另一个,我有错误。 首先,我failed to update auto layout status: the agent crashed , Failed to render instance of … 。 不知何故,我开始能够biuld和运行这些错误的项目,但后来我得到新的错误 – EXC_BAD_ACCESS …在线let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView 。 这里是整个方法: func loadViewFromNib() -> UIView { let bundle = NSBundle(forClass: self.dynamicType) let […]

我可以animationiOS8的LaunchScreen.xib图像

题: 有没有方法在Xcode 6项目的LaunchScreen.xib文件中设置任何目标为iOS 8.1+进行部署? 语境: 我正在寻找简单的animation来传达活动或作为一个分心的用户,而他们等待… 例子: 一个载入栏 活动指标 animationGIF 在屏幕上移动UIImage 旋转图像

在这种情况下,XIB中的文件所有者是什么?

我search了相当一段时间的类似问题,其中大部分提到UIViewController的xib的东西。 我试图为我的自定义viewController模型添加一个xib文件,并发现它的Xib文件的所有者应该是我自定义viewController模型的类 – 这是合理的。 但为什么情况不同,当我为我的UIView模型创build一个xib – 一个例子如下: 我创build了我的名为“KWView”(KWView.h和KWView.m)的UIView模型,然后我为这个模型创buildxib,初始化它 KWView *oneView = [[[NSBundle mainBundle] loadNibNamed:@"KWView" owner:nil options:nil ]lastObject]; 这Xib的文件的所有者名称是“NSObject” (然后我尝试任何其他更多,无论我select,它运行顺利) ,在那里,我select视图的自定义类为“KWView”[这个xib名为“KWView.xib”] 问题是: 1.无论我更改自定义视图的Xib文件的所有者名称,它的工作原理。 如果是这样,这个文件的所有者在这里做什么工作,或者说,为什么会发生这种情况? 2.一般情况下,我应该将自定义视图的Xib的文件所有者设置为我的自定义视图的类或viewController的类,这个视图将被添加到? 或者只是设置“NSObject”?

Xcode Storyboard和xib连接

我有一个故事板项目与许多视图控制器,我创build了一个名为“connecter.h,connector.m”类现在我可以连接这个类到一个.xib文件? 请帮帮我。