Tag: iphone

UITextView自动完成气泡位置

在UITextView中输入数据时,我对自动完成气泡定位感到困惑。 我所观察到的是,根据其框架的来源,自动完成的气泡要么位于顶部,要么位于底部。 如果scrollEnabled设置为NO ,则没有固定位置。 这是两个链接。 代码是用init()编写的 UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 150, 320, 41)] autorelease]; view.backgroundColor = [UIColor grayColor]; [self.view addSubview:view]; UITextView *growingTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 10, 200, 27)]; growingTextView.font = [UIFont fontWithName:@”Helvetica” size:13]; growingTextView.scrollEnabled = NO; [view addSubview:growingTextView]; UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 50, 320, 41)] autorelease]; view.backgroundColor = [UIColor grayColor]; […]

objective-c中的类变量内存生命周期

如果我在.m文件中声明一个类变量(与实例变量形成对比)并通过setter和getter访问它,例如[MyClass setValue],[MyClass Value] 这个可变内存何时被分配,何时被释放? 我刚才从上一个问题中想到了一个新问题: 如何存储相对静态但可配置的信息

如何重命名xcode项目文件

可能重复: 如何在Xcode中重命名项目? 嗨,我想要更改我的xcode项目所在的文件的名称。但是当我尝试执行此操作时,我将导航器菜单中的所有文件名重新加载为红色… 更新的问题,我能够重命名我的项目,但它没有改变这一点 它仍然显示testtable2 …我不知道为什么..是因为整个项目所在的文件夹名称?

Objective-C:_variable

好吧,以前一定要问这个但是我看起来很生气,一无所获: 我在我的iPhone应用程序中有一个简单的数组,我这样定义: @property (nonatomic, strong) NSArray *pages; @synthesize pages = _pages; 我在Apples示例代码中看到了这一点,并认为这是编写self.pages(即_pages替换self.pages)的一个很好的捷径,如下所示: _pages = [[NSArray alloc] init]; 但是苹果又有了这个(不完全像这样,但看起来好像他们一直在随意交换): self.pages = [NSKeyedUnarchiver unarchiveObjectWithData:contents]; 最后: [_pages release]; 这让我很困惑。 _pages和self.pages之间有什么区别? 谢谢你的帮助。

如何在iOS中加密mp3文件

我有一个应用程序从我们的Web服务器下载MP3文件,并暂时将它们存储在NSData对象中。 然后将此对象写入存储在应用程序沙箱中/ Library / Cache文件夹中的.mp3文件。 在播放文件时,我将其加载到AVPlayerItem中,如下所示: NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@”%@.mp3″, trackID]]; NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath]; self.trackPlayerItem = [[AVPlayerItem alloc] initWithURL:fileURL]; 我想继续把这个项目加载到AVPlayer并播放它。 所以我的主要问题是:如何将这些mp3文件存储在磁盘上,以确保它们不能被任何拥有越狱设备的人从文件系统中提取出来? 我已经看过Stack Overflow但找不到任何帮助。 希望有人可以帮助我。 谢谢

在nsuserdefaults中保存选中标记附件值,然后将其撤消

嗨我想在nsuserdefault中保存勾选行的状态。有些我如何得到错误:setObject undeclared。 我的代码如下: – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath]; NSInteger newRow = [indexPath row]; NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; if(newRow != oldRow) { newCell.accessoryType = UITableViewCellAccessoryCheckmark; UITableViewCell *oldCell = [tableView cellForRowAtIndexPath:lastIndexPath]; oldCell.accessoryType = UITableViewCellAccessoryNone; lastIndexPath = indexPath; } NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; prefs […]

在调整帧大小后禁用uiviews按钮中的用户操作

我有一个UIView子类,让我们称之为PopupView。 在这个PopupView中,我确实有一个带有自定义uiview的NavigationBar,里面有一个uibutton (2) 。 另外在PopupView中直接有一个UIButton (1) 。 PopupView – UIButton (1) – UINavigationBar – UINavigationItem – UIBarButtonItem – UIView – UIButton (2) 这个uibutton在uinavigationbar疯狂的原因是因为我可以在一个uibutton中使用capinsets作为背景图像,而不是在uibarbuttonitem中使用capinsets。 我的问题: 我使用uiview动画调整PopupView的大小, 动画完成后,我无法再单击此uiview中的按钮 。 [UIView animateWithDuration:0.4f delay:0.0f options:UIViewAnimationCurveEaseOut animations:^{ CGRect popupFrame = self.frame; popupFrame.size.height += 140.0f; popupFrame.origin.y = floorf(popupFrame.origin.y – (140.0f / 2)); self.frame = popupFrame; } completion:^(BOOL finished) { }]; 如果我不使用uiview动画并直接设置新帧,也会发生这种情况。 […]

在我的应用程序处于后台时更新它

我想将一些数据更新到我的应用程序。 考虑应用程序处于后台状态,它既不是Voip,也不是音乐或GPS。 是否可以更新/发送数据到后台的应用程序? 注意:我不想通知用户,以便应用程序变为活动状态。 谁能帮我 ??

在合并暂定定义时,iOS对齐丢失了

当我存档我的iOS应用程序时,我收到以下错误: ld: warning: alignment lost in merging tentative definition _isDragging ld: warning: alignment lost in merging tentative definition _isLoading 有人可以告诉我什么是错的,我应该在哪里找… 谢谢!

访问并设置iphone默认闹铃

我想访问iphone默认闹钟,并根据用户提交的日期设置闹钟。我也希望用户改变闹钟的声音。 有可能这样做,如果有可能我该怎么做? 这是可用的代码吗? 请帮我带我走出这个。 -提前致谢。