我正在尝试使用iOS5和新方法创建一个容器视图控制器addChildViewController.
打电话addSubview后我必须打电话addChildViewController吗?
在打电话removeFromSuperview之前我必须打电话removeChildViewController吗?
我在Apple文档中没有看到任何相关内容.你怎么看?
我有一个iPhone应用程序,它使用UINavigationController应用程序导航的标准实现.
我试图找出一种方法来替换层次结构中的视图控制器.换句话说,我的应用程序加载到一个rootViewController用户按下按钮时,应用程序将推送到firstViewController.然后用户按下另一个按钮以将应用程序导航到secondViewController.再次使用导航到另一个视图控制器,thirdViewController.但是,我希望它的BackButton thirdViewController弹回到firstViewController.
基本上,当用户推送时thirdViewController,我希望它secondViewController在导航层次结构中替换.
这可能吗?我知道它正在使用Three20,但我不是在这种情况下.尽管如此,如果它可以在Three20中使用,那么肯定应该使用直接的SDK调用.有人有想法吗?
干杯,布雷特
我看到特定于在iOS 8上运行的应用程序的新崩溃.无法弄清楚问题是什么,无法重现问题.发生在App StartUp,App不直接调用OpenGL ES函数.
InitialViewController viewDidAppear方法行#92我通过以下方式从故事板发起一个segue:[self performSegueWithIdentifier:segueIdentifier sender:self];where self是InitialViewControllerclass.
堆栈跟踪:
Thread: Unknown Name (Crashed)
0 libGPUSupportMercury.dylib 0x28c5c8fe gpus_ReturnNotPermittedKillClient + 10
1 libGPUSupportMercury.dylib 0x28c5d249 gldCreateContext + 206
2 GLEngine 0x248a093b gliCreateContextWithShared + 600
3 OpenGLES 0x2497cab3 -[EAGLContext initWithAPI:properties:] + 404
4 CoreImage 0x225ecb8b ___ZN2CI11can_use_gpuEv_block_invoke + 140
5 libdispatch.dylib 0x2fbb98b7 _dispatch_client_callout + 20
6 libdispatch.dylib 0x2fbba4fb dispatch_once_f + 60
7 CoreImage 0x225ecafb _ZN2CI11can_use_gpuEv + 96
8 CoreImage 0x2256ac79 +[CIContext contextWithOptions:] + 186
9 CoreUI 0x27bdc837 CreateSharedCIContext …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取要下载的组件URL列表.我正在使用NSURLConnection来获取具有此URL列表的JSON文件.在
- (void)connection:(NSURLConnection *)connection didWriteData:(long long)bytesWritten totalBytesWritten:(long long)totalBytesWritten
Run Code Online (Sandbox Code Playgroud)
我写的总字节数是122239.什么时候
- (void)connectionDidFinishDownloading:(NSURLConnection *)connection destinationURL:(NSURL *)destinationURL
Run Code Online (Sandbox Code Playgroud)
我正在尝试读取url数据以提取JSON文件:
NSData *data = [NSData dataWithContentsOfURL:destinationURL options:NSDataReadingUncached error:&error];
Run Code Online (Sandbox Code Playgroud)
数据总是给我一个零值也有122239字节写在这个文件中,错误打印说明显示"没有这样的文件或目录"
Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn\u2019t be completed. (Cocoa error 260.)" UserInfo=0x4a1b90 {NSFilePath=/private/var/mobile/Applications/CD8E4838-D78D-41DE-8896-360B7FC02A1D/tmp/c1749157e1d4317f6158a8490e138e7e, NSUnderlyingError=0x4c5ae0 "The operation couldn\u2019t be completed. No such file or directory"}
Run Code Online (Sandbox Code Playgroud)
有什么建议?
谷歌没有发现此错误消息的帖子.我在iOS 5中尝试更新UITableView.虽然确切的代码有点折磨,但这正是我对表和具有表数据的NSMutableArray所做的.调用是通过performSelectorOnMainThread调用从主线程进行的,如下面的代码片段所示.NSMutableArray节是一个数组数组,每个数组表示一个节,其中这些辅助数组是NSStrings,其中包含表中显示的文本.
[table performSelectorOnMainThread: @selector(beginUpdates) withObject: nil waitUntilDone: YES];
Run Code Online (Sandbox Code Playgroud)
// Make sure the requested section exists.
if (sections == nil)
sections = [[NSMutableArray alloc] init];
while (section >= [sections count]) {
NSMutableArray *newArray = [[NSMutableArray alloc] init];
[sections addObject: newArray];
[table insertSections: [NSIndexSet indexSetWithIndex: [sections count]]
withRowAnimation: UITableViewRowAnimationNone];
}
// Insert the new row in the section.
NSMutableArray *rowArray = [sections objectAtIndex: section];
if (row > [rowArray count])
row = [rowArray count];
[rowArray insertObject: cellString atIndex: row];
[table …Run Code Online (Sandbox Code Playgroud) 我已经实现了一个自定义电影播放器AVPlayer.在将videoGravity的值设置AVPlayerLayer为AVLayerVideoGravityResizeAspectFillI 时,我会看到所需的效果iOS 4.2, 4.3.但不知何故,iOS 5.0它没有任何效果.有人看到类似的问题吗?难道我做错了什么?
我正在开发一个网站来部署我的iPhone应用程序.用户可以从网站的应用列表中选择多个iOS应用,当他们点击下载时,所有应用都必须逐个安装到手机上.立即检查所有应用程序 - 单击下载 - 然后将自动下载并安装所有应用程序.这怎么可能?有没有办法我可以更改这个plist文件,其中url dict是一个数组?
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>http://web.me.com/macdev/apps/app1.ipa</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.macdev.inhouse.app1</string>
<key>bundle-version</key>
<string>1.0</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>App Demo</string>
</dict>
</dict>
</array>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud) 我是Objective C的新手,我一直在尝试使用从一个视图控制器到另一个视图控制器的按钮来进行Segue.我希望对segue使用push类型,第一个视图控制器嵌入到导航视图控制器中.下面是第一个视图控制器的.m和.h文件.
firstViewController.m
@implementation
**(am I supposed to have an IBAction here for the pressed button?)**
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"firstSegue"]) {
**( I don't know what to put here)**
}
}
@end
Run Code Online (Sandbox Code Playgroud)
firstViewController.h
@interface firstViewController : UIViewController
@end
Run Code Online (Sandbox Code Playgroud) 我是iOS应用开发的新手.我正在处理延迟加载的图像UICollectionView.图像正在显示,但是当我滚动UICollectionView图像时,图像会改变它们的位置,并且重复图像,其中所有图像应该是唯一的.这是我的代码:
- (MyCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
MyCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CELL" forIndexPath:indexPath];
cell.imageview_collectnvw.layer.cornerRadius=6.0f;
cell.imageview_collectnvw.layer.masksToBounds=YES;
dispatch_queue_t queue = dispatch_queue_create("patientlist",NULL);
dispatch_async(queue, ^{
NSString *str=[[[search_array objectAtIndex:indexPath.row]valueForKey:@"friend"]valueForKey:@"linkedin_photo"];
NSLog(@"cell index path --- is %d",indexPath.row);
NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:str]];
dispatch_sync(dispatch_get_main_queue(), ^{
if ([[collectionView indexPathsForVisibleItems] containsObject:indexPath]) {
MyCell *cell = (MyCell*)[collectionView cellForItemAtIndexPath:indexPath];
cell.imageview_collectnvw.image=[UIImage imageWithData:data];
}
[cell setNeedsLayout];
NSLog(@"cell index path main is %d",indexPath.row);
});
});
return cell;
}
Run Code Online (Sandbox Code Playgroud)
这可能是一个愚蠢的问题,但我需要答案..如果有人能够回答这个问题,将会有很大的帮助.提前致谢.
我有这个字符串代码,我在尝试释放内存时遇到问题,我了解到只有那些释放它的人才进行初始化,而不是自动释放,但是我遇到了字符串“ end”和nSum版本的问题。
NSString *urlBase = [[NSString alloc] initWithFormat:@"http://service.svc/"];
NSString *op = [[NSString alloc] initWithFormat:@"op1"];
NSString * final = [urlBase stringByAppendingFormat:op];
NSString * nSum = sumTextfield.text;
final = [final stringByAppendingFormat:nSum];
//release
[ urlBase release ];
[ op release ];
//[final release]; error
//[final autorelease]; error
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助。
更新:
- (IBAction)mostrarOpciones {
// code (UP)
}
Run Code Online (Sandbox Code Playgroud) ios ×5
ios5 ×4
objective-c ×4
iphone ×3
xcode4 ×2
avplayer ×1
cocoa-touch ×1
ios8 ×1
release ×1
segue ×1
uikit ×1
uitableview ×1