这是我的设置:我有一个CALAyer,我想添加子图层.我通过设置UILabel然后将UILables图层添加到我的主图层来创建这些子图层.当然这会留下沉重的UILabel对象在背景中盘旋.是否有可能从UIView获取包含其所有内容的图层并摆脱UIView本身?我已经尝试过了:
UILabel* label;
[...]
[mainLayer addSublayer:[label.layer copy]];
[label release];
Run Code Online (Sandbox Code Playgroud)
但每当我发布UIView时,图层的内容也会被删除.这甚至可能还是UIView的图层总是需要UIView本身才能显示它的内容?我认为这层是UIView所描绘的一种画布.我想我可能错了这个假设:)
我已经设置了一个UIView,并在视图的图层中添加了几个CALayers作为子图层.甚至可以随着视图调整子图层的大小吗?当我通过设置新帧来调整图层大小时,只有视图的图层会获得新的大小,而不是子图层.我将图层的setNeedsDisplayOnBoundsChange设置为true,将contentsGravity设置为kCAGravityResizeAspect,但到目前为止没有任何帮助.我错过了很明显的东西吗?
谢谢,亲切的问候,汉斯
Xcode 3.2打破了我的iPhone应用程序的构建过程.我需要在我的项目中添加一个新框架(MediaPlayer.framework).
所以我进入我的目标设置并尝试通过点击[+]按钮将其添加到"链接图书馆".在列表中缺少MediaPlayer.framework,以及其他框架,例如UIKit,CoreGraphic等.一些框架仍然存在.
I can add the frameworks by adding the SDK-specific ones (going into /Developer/Platforms/iPhoneOs.platform/...yadayadayada../frameworkd/) but then of course I can only compile for the iPhone platform and not for the simulator any more.
So basically I wonder how I can get Xcode back to chose the appropriate framework, depending on platform and SDK version for me?
Thanks and kind regards, Hans Schneider
Edit: Things I tried: Setting the Base SDK to 3.0 (was still 2.2.1), reinstalling 3.0 iPhone …
我想这不是特定于视频上传,因为我只是在图表上发帖子,但是当我使用下面的代码时,上传有时会停止.较小的视频(<20MB)可靠地通过,但较大的视频(50至200 MB)保证失败.
NSData *videoData = [NSData dataWithContentsOfFile:video.localURL options:NSDataReadingMappedAlways error:&error];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, video.localURL,
@"video/quicktime", @"contentType",
video.name, @"title",
NSLocalizedString(@"Test http://www.apple.com", @"Facebook upload description"), @"description",
nil];
FBRequest *request = [FBRequest requestWithGraphPath:@"me/videos" parameters:params HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSLog(@"result: %@, error: %@", result, error);
[[NSNotificationCenter defaultCenter] postNotificationName:FacbookUploadFinishedNotification object:nil];
}];
Run Code Online (Sandbox Code Playgroud)
我修补了FBURLConnection以获取有关上传进度的通知:
- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
NSDictionary *userInfo = [NSDictionary dictionaryWithObjects:
[NSArray arrayWithObjects:
[NSNumber numberWithInt:totalBytesWritten],
[NSNumber numberWithInt:totalBytesExpectedToWrite],
nil]
forKeys:
[NSArray arrayWithObjects:
@"bytes",
@"totalBytes",
nil]
]; …Run Code Online (Sandbox Code Playgroud)