Tag: ipad

奇怪的Objective-C语法 – 方括号和@符号

我在我的一个项目中使用GHSidebarNav,我碰到这个代码分配一个对象的数组。 我只是不知道它在做什么。 它只是一个数组? 这个奇怪的语法是什么? 我之前没有看到: NSArray *controllers = @[ @[ [[UINavigationController alloc] initWithRootViewController:[[GHRootViewController alloc] initWithTitle:@"Profile" withRevealBlock:revealBlock]] ], @[ [[UINavigationController alloc] initWithRootViewController:[[GHRootViewController alloc] initWithTitle:@"News Feed" withRevealBlock:revealBlock]], [[UINavigationController alloc] initWithRootViewController:[[GHMessagesViewController alloc] initWithTitle:@"Messages" withRevealBlock:revealBlock]], [[UINavigationController alloc] initWithRootViewController:[[GHRootViewController alloc] initWithTitle:@"Nearby" withRevealBlock:revealBlock]], [[UINavigationController alloc] initWithRootViewController:[[GHRootViewController alloc] initWithTitle:@"Events" withRevealBlock:revealBlock]], [[UINavigationController alloc] initWithRootViewController:[[GHRootViewController alloc] initWithTitle:@"Friends" withRevealBlock:revealBlock]] ] ];

将Instagram图像拉到我的应用程序

我正在开发和iPad的iPad应用程序,在那里你可以个性化茶杯导入照片从卷。 我很想添加Instagram,所以用户可以添加他的Instagram的照片。 有没有任何SDK或插件?

透明的UIPopover

有没有办法使UIPopOver透明(alpha = 0.75左右)。 不幸的是,UIPopOver没有alpha属性。 我需要提供一个popover,以便它下面的视图仍然是部分可见的。 有任何想法吗

UIActivityViewController在Swift崩溃在iPad上

我在我的游戏中做了一个共享function,我有代码,它在iPhone上工作正常,但是当我在iPad上testing时,当我点击分享button时,应用程序崩溃。 我正在使用共享button下面的代码 let textToShare = "Check out this website!" if let myWebsite = NSURL(string: "http://www.apple.com/") { let objectsToShare = [textToShare, myWebsite] let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil) self.view?.window?.rootViewController?.presentViewController(activityVC, animated: true, completion: nil) }

数据未保存到核心数据

我正在使用专门为iOS 7编译的Xcode 5。 我正在从UTF8 txt文件读取数据以填充核心数据实体。 读完数据后,我将它logging到控制台。 数据在那里。 我填充实体并将实体logging到控制台。 我保存它。 没有错误。 没有崩溃。 我在设备上看到3个文件: MyDatabase.sqlite MyDatabase.sqlite-SHM MyDatabase.sqlite,沃尔玛 当应用程序启动并创buildMyDatabase.sqlite时,它有40 kb。 在这一点上, shm文件是32kb, wal文件是零。 将数据写入数据库之后, wal文件增长到1,7 Mb,而其他两个文件保持其初始大小,换句话说,数据不会被保存到数据库。 我已经证实,通过检查与外部数据库查看器的sqlite文件。 这是我正在使用的代码: // NSArray *arrayOfYears = … // this contains an array of numbers read from the CSV file // at this point the array contains numbers in text format // NSArray […]

在视图控制器之间传递数组?

我真的需要更多的帮助! 我想从一个视图控制器传递数组到另一个。 我认为后者是一个“孩子”视图控制器? 我的代码如下: MainViewController.h: #import <UIKit/UIKit.h> #import <AudioToolbox/AudioToolbox.h> #import <AVFoundation/AVFoundation.h> @interface HelloWorldIOS4ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, AVAudioPlayerDelegate> { NSMutableArray *countProductCode; UIPopoverController *detailViewPopover; } @property (nonatomic, retain) NSMutableArray *countProductCode; @property (nonatomic, retain) UIPopoverController *detailViewPopover; – (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data; … @end MainViewController.m #import "HelloWorldIOS4ViewController.h" #import "JSON.h" #import "PopoverContentViewController.h" @implementation HelloWorldIOS4ViewController @synthesize detailViewPopover; @synthesize countProductCode; […]

iOS:从plist文件加载图像

我试图从一个plist文件显示各种图像到UIImageView,我写我的代码是这样的: NSDictionary *picturesDictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Photos" ofType:@"plist"]]; imageArray = [picturesDictionary objectForKey:@"PhotosArray"]; PhotosInAlbum.image = [UIImage imageWithContentsOfFile:[imageArray objectAtIndex:1]]; 但实际上没有任何反应,我的ImageView是空的! 我也有两个button来转发后面的图像。 Plist的内容:

在自定义UITableViewCell中更改自定义UIButton的位置

我需要dynamic地改变UIButton的位置。 我在cellForRowAtIndexPath:做这个cellForRowAtIndexPath: 我改变该方法中的button的框架。 最初显示表时,不会显示更改。 但是当我滚过单元格并回到它时,就会显示出来。 同样,当我第一次滚动到最初不可见的单元格时,没有任何变化。 当我第二次滚动时,会发生变化。 我已经尝试setNeedsDisplay:在自定义button和表视图。 我甚至在willDisplayCell:forRowAtIndexPath:做了这个。 我如何解决这个问题? 编辑:我忘了提及,我从一个nib文件加载UITableViewCell。 这里是调整框架的代码。 label1.text = //text from some source label1.text = [label1.text stringByAppendingString:@" |"]; [label1 sizeToFit]; CGRect frameAfterResize=label1.frame; float x=frameAfterResize.origin.x+frameAfterResize.size.width; button.frame=CGRectMake(x+2, button.frame.origin.y, button.frame.size.width,button.frame.size.height);

不能在SpriteKit中转换

我有一个场景调用下一个像这样的过渡: SKTransition *transition = [SKTransition revealWithDirection:SKTransitionDirectionDown duration:0.5]; SKView *skView = (SKView *)self.view; SKScene * scene = [[GameOverScene alloc] initWithSize:self.size]; scene.scaleMode = SKSceneScaleModeAspectFill; [skView presentScene:scene transition:transition]; 构成GameOverScene (button,图像等)的元素被添加到其init方法中。 问题是没有看到过渡。 一个场景立即切换到另一个场景。 我想这个过渡发生在下一个场景有机会构build它的元素之前。 我试图将下一个场景的创build移动到didMoveToView而没有成功。 为了testing的目的,我试图延迟presentScene线的时间甚至大于2秒。 当我这样做时,我几乎看不到转换的结束帧。 我怎么做? build立下一个场景和做一个有效的转换的正确方法是什么?

NSCountedSet – 获取集合中的项目数

我有一个信息数组,我有多个名称,我想要匹配和计数,然后移动到一个表视图,你会看到一个消息应用程序。 我已经达到了这一点。 在哪里我可以login,看看我想要什么,但根本找不到任何解决scheme从该集合中拉出信息,并相应放置到一个tableview 。 例 – (void)directMessagesReceived:(NSArray *)messages forRequest:(NSString *)connectionIdentifier{ for(NSDictionary *d in messages) { // NSLog(@"See Direct Messageges Parsing Info: %@", d); Tweet *tweetDic = [[Tweet alloc] initWithTweetDictionary:d]; //[directMessages addObject:tweetDic]; [tweetDic autorelease]; } //[arayToScan addObject:[messages valueForKey:@"sender_screen_name"]]; [arayToScan addObjectsFromArray:messages]; [self checkForDuplicateIDs]; // NSLog(@"Same ScreenName Received: %@", arayToScan); //[self.mainTableView reloadData]; NSLog(@"DM COUNT = %i",[directMessages count]); [DSBezelActivityView […]