Tag: cocoa touch

隐藏来自UIPageViewController的点

我想做一个非常简单的事情。 只要删除所有的点,并在UIPageViewController底部的酒吧。 这是设置:我有一个自定义视图控制器,它具有UIPageViewController * pageController我显示它是这样的: self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; self.pageController.dataSource = self; [[self.pageController view] setFrame:[self.view bounds]]; BSItemPageViewController *initialViewController = [self viewControllerAtIndex:selectedIndex]; NSArray *viewControllers = [NSArray arrayWithObject:initialViewController]; [self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil]; [self addChildViewController:self.pageController]; [[self view] addSubview:[self.pageController view]]; [self.pageController didMoveToParentViewController:self]; 任何想法如何删除点?

无法closuresMFMailComposeViewController,委托没有被调用

我从UITableViewController调用MFMailComposeViewController 。 问题是当我在邮件撰写窗口中select“ 取消”或“ 发送”button时,从不会调用委托方法: mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult 这是表视图类: @implementation DetailsTableViewController – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section==0 && indexPath.row==4) { //SEND MAIL MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init]; controller.mailComposeDelegate = self; if ([MFMailComposeViewController canSendMail]) { [controller setSubject:[NSString stringWithFormat:@"Ref %@",[item objectForKey:@"reference"]]]; [controller setMessageBody:@" " isHTML:NO]; [controller setToRecipients:[NSArray arrayWithObject:[item objectForKey:@"email"]]]; [self presentModalViewController:controller animated:YES]; } [controller release]; } […]

replaceCLLocationManager的“目的”属性

在iOS 6中,用于描述使用位置服务( @property(copy, nonatomic) NSString *purpose )的原因的CLLocationManager的purpose属性已被弃用。 苹果公司提出了什么样的替代品?

为ios 360°全景图库

是否有任何图书馆或课程在iPhone上显示360度全景? 我在这里find了这个: http : //code.google.com/p/panoramagl/,但它不是最新的,只适用于老版本的ios。 我非常感谢任何可以帮助我创buildios 360度全景视图的链接。

当用户更改“联系人”访问权限时,应用程序在iOS 6中崩溃

我有一个使用地址簿的应用程序。 当在iOS 6中运行时,它会在用户做某些需要通讯录访问的情况下运行此代码。 if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) { ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL); ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) { if (granted) { showContactChooser(); } }); CFRelease(addressBookRef); } else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized) { showContactChooser(); } else { showAccessDeniedAlert(); } 这是完美的作品:我能读取联系人信息,当用户拒绝访问,应用程序作出相应的反应。 但是,如果用户: 允许在应用程序中访问联系人, 退出应用程序, 进入设置 – >隐私 – >联系人,并禁用应用程序的联系人访问, 运行应用程序, 当应用程序在后台运行时会转到设置并启用应用程序的联系人访问, 应用程序立即崩溃在main() ,没有exception信息或有意义的堆栈跟踪。 我试着打开“所有exception”和[NSException raise]断点,但是这并没有给我更多的信息。 即使应用程序在启动期间没有运行上述代码,也可以复制崩溃。 […]

何时使用静态string与#define

我有点困惑,何时最好使用: static NSString *AppQuitGracefullyKey = @"AppQuitGracefully"; 代替 #define AppQuitGracefullyKey @"AppQuitGracefully" 我已经在C或C ++中看到类似这样的问题,我认为这里的不同之处在于,这是专门针对Objective C的,利用一个对象,而在像iPhone这样的设备上,可能存在堆栈,代码空间或内存问题我还没有把握。 一个用法是: appQuitGracefully = [[NSUserDefaults standardUserDefaults] integerForKey: AppQuitGracefullyKey]; 或者这只是一个风格问题? 谢谢。

如何更改UISegmentedControl的字体颜色

我尝试将UISegmentedControl字体颜色从白色更改为黑色(对于iOS 4. *) UISegmentedControl *button = [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:itemTitle, nil]] autorelease]; button.momentary = YES; button.segmentedControlStyle = UISegmentedControlStyleBar; button.tintColor = [UIColor redColor]; for (id segment in [button subviews]) { for (id label in [segment subviews]) { if ([label isKindOfClass:[UILabel class]]) { UILabel *titleLabel = (UILabel *) label; [titleLabel setTextColor:[UIColor blackColor]]; } } } UIBarButtonItem *barButtonItem […]

如何防止button的背景图像拉伸?

我将一个UIButtonTypeCustom UIButton分配给一个背景图像小于button的框架的UIView。 为什么图像更小的原因是因为我试图为UIButton添加更多的“目标区域”。 然而,图像正在缩放到框架的整个大小,而不仅仅是图像的大小。 我试图将UIButton和UIButton的imageView contentMode属性设置为“UIViewContentModeScaleAspectFit”,但没有运气,图像仍然伸出。 有没有办法做我想要以编程方式做? 提前致谢!

在失去对UITextView的焦点时隐藏键盘

所以我有一个UITextView,我用它来允许用户提交一些文本。 我的问题是,我似乎无法弄清楚如何允许用户通过从UITextView中删除“取消”。

获得最顶级的UIViewController

如果我在UINavigationController上推视图控制器和/或呈现模态视图控制器,我怎样才能找出最顶层的UIViewController ? 或者在我的情况下,我想知道如果某个UITableViewController是最重要的或不是。 我试过使用: self.navigationController.topViewController == self …但这不起作用。 我猜这是失败的,因为我在它上面展示了模态视图控制器,并且topViewController只跟踪哪些视图被推送到UINavigationController (而不是模态显示的那些视图)。