无论如何我在这里找不到答案,也没有看到重复的问题.
我的代码很简单.给定3 UIView,parent,from和to,从parent中删除并添加子视图.+添加动画,但这只是doodads.
现在,问题是当我这样做时,然后得到抵消.好像它被推倒了.
我甚至添加了To.frame = ParentView.frame; 确保它有效.它没有.
我该怎么办?
+ (void) AnimateSwitchingWithParent: (UIView *) ParentView From: (UIView *) From To: (UIView* ) To
{
/*[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:ParentView cache:YES];*/
[From removeFromSuperview];
[ParentView addSubview:To];
To.frame=ParentView.frame; //If I don't do this, the subview is still off by around 20 points
NSLog(@"To.bounds: %@", NSStringFromCGRect(To.bounds));
NSLog(@"From.bounds.: %@", NSStringFromCGRect(From.bounds));
NSLog(@"ParentView.bounds: %@", NSStringFromCGRect(ParentView.bounds));
//JA_DUMP (To.bounds);
//JA_DUMP (To.bounds);
/*[UIView commitAnimations];*/
}
Run Code Online (Sandbox Code Playgroud)
我已经找到了解决方案.结果是To的框架
To.frames:{{0,0},{320,372}}
但是,如果我删除To.frame = ParentView.frame,那么框架也是如此
{{0,20},{320,460}}
我想知道为什么?20点似乎是状态栏的距离.我们在哪里可以在InterfaceBuilder中设置该框架?
我在SimulatedMetric部分中将statusbar设置为none.
我的其他程序员从网上下载了这段代码
#import "UIImage+Alpha.h"
// Private helper methods
@interface UIImage ()
- (CGImageRef)newBorderMask:(NSUInteger)borderSize size:(CGSize)size;
@end
@implementation UIImage (Alpha)
Run Code Online (Sandbox Code Playgroud)
我得到错误:什么原因导致Category正在实现一个方法,该方法也将由其主类实现?
我在我的整个文件中搜索newBorderMask,这个单词只显示3次.
它只被声明一次
@interface UIImage ()
- (CGImageRef)newBorderMask:(NSUInteger)borderSize size:(CGSize)size;
@end
Run Code Online (Sandbox Code Playgroud)
即实施一次
#pragma mark -
#pragma mark Private helper methods
// Creates a mask that makes the outer edges transparent and everything else opaque
// The size must include the entire mask (opaque part + transparent border)
// The caller is responsible for releasing the returned reference by calling CGImageRelease
- (CGImageRef)newBorderMask:(NSUInteger)borderSize size:(CGSize)size1 { …Run Code Online (Sandbox Code Playgroud) 假设我在Xcode中遇到了一些编译器错误.假设我想询问Stack Overflow上的那些错误.
我该怎么办?我是否必须阅读警告信息并输入?
很多人都会询问确切的错误,没有拼写错误; 我打赌有一种方法可以复制并粘贴这些错误.它是什么?
2012-06-15 17:53:25.532 BadgerNew[3090:707] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[_PFBatchFaultingArray objectAtIndex:]: index (0) beyond bounds (0)'
*** First throw call stack:
(0x353f688f 0x3779d259 0x353f6789 0x353f67ab 0x35d5fee3 0x5a5c9 0x59fd3 0x43819 0x32e63c8b 0x38153 0x38309 0x32e63c8b 0x4142d 0x32e63c8b 0x32ec363d 0x32ec35db 0x32ec2f15 0x32ec2c49 0x35d21 0x32e62cab 0x32e5c7dd 0x32e2aac3 0x32e2a567 0x32e29f3b 0x36fe922b 0x353ca523 0x353ca4c5 0x353c9313 0x3534c4a5 0x3534c36d 0x32e5b86b 0x32e58cd5 0x35a73 0x35a54)
terminate called throwing an exception(lldb)
Run Code Online (Sandbox Code Playgroud)
问题是什么?
它在主要的中止.所以我甚至不知道哪一行导致了这一点.
提示:在模拟器上运行.在我的iPhone上运行.不能在我朋友的iPhone上运行.
-(void) scrollViewDidScroll:(UIScrollView *)scrollView
{
PO(NSStringFromCGPoint(self.tableView.contentOffset));
PO(NSStringFromUIEdgeInsets(self.tableView.contentInset));
while(false);
}
-(void)dealloc
{
PO(NSStringFromClass([self class]));
PO(@"Deallocated");
self.tableView.delegate=nil;
}
Run Code Online (Sandbox Code Playgroud)
这里我需要设置self.tableView.delegate = nil以避免错误.
从我之前的问题我知道,当委托被销毁时,self.tableView.delegate不会自动变为nill.那是因为委托的类型是赋值引用而不是弱引用.
但是,self.tableView怎么样?
唯一强烈引用self.tableView的是它的自我和自我拥有的超级视图.
所以当self被破坏时,self.tableView也应该被破坏,这意味着self.tableView.delegate也将消失.
那么我为什么需要设置self.tableView.delegate=nil;
如何做第2步?
如何显示"助理编辑器"?
我认为xcode 3使用后者,xcode 4使用前者.
它们可以互换吗?
NSMergeByPropertyObjectTrumpMergePolicy并且NSOverwriteMergePolicy在一件事情上是一样的.该属性会覆盖商店中的属性.
那么它们之间有什么不同呢?在我可以想到的所有情况下,无论持久性存储中的那个是否已经改变,该属性都会覆盖持久性存储.
还有什么是冲突?
我认为冲突只是意味着数据不同.这是否意味着核心数据最初设计为一旦数据写入就无法更新?
如果冲突不仅仅是"数据不同",那么NSOverwriteMergePolicy和之间的区别是NSErrorMergePolicy什么?
在这两种情况下,仅仅数据差异无论如何都不是冲突,因此不存在冲突.
我收到了这个错误:
Error 1 Unable to open module file 'D:\business\shared\Dropbox\badgers\vb\vb.net\My Project\Application.Designer.vb': The system cannot find the path specified. D:\business\shared\Dropbox\badgers\vb\vb.net\My Project\Application.Designer.vb 1 1 traverseweb4
Run Code Online (Sandbox Code Playgroud)
Application.designer.vb是生成的文件.我只是删除了那个.如何重新生成?
如果我用notepad ++直接打开.vbproj文件,我看到:
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
Run Code Online (Sandbox Code Playgroud)
所以它显然是自动生成的,为什么vb.net因为没有那个愚蠢的文件而责怪我?
顺便说一句,在记事本++中删除那些愚蠢的行是有效的.现在事情很完美.但这让我很生气.
任何人都可以解释为什么它首先发生?为什么要修复这个.vbproj文件是必要的?
objective-c ×4
xcode ×4
core-data ×2
xcode4 ×2
addsubview ×1
conflict ×1
delegates ×1
ios ×1
iphone ×1
subview ×1
superview ×1
vb.net-2010 ×1
xcode4.3 ×1