iPad编程指南指出,splitView的左窗格固定为320点。 但是我的主视图控制器的320像素太多了。 我想减less它,并给予更多的空间来详细视图控制器。 反正可能吗? 链接到说明固定宽度的文档 。
我将如何去绘制一个实际上只是一个球(2D圈)的自定义UIView? 我会重写drawRect方法吗? 有人能告诉我画蓝色圆圈的代码吗? 另外,在类本身中改变视图的框架可以吗? 还是我需要改变不同类别的框架? (试图设置一个弹跳的球)
给定一个HTML DOM ID,如何在JavaScript / JQuery中获取元素相对于窗口的位置? 这不是相对于文档也不是相同的,因为元素可能在iframe或其他元素中。 我需要获取元素的矩形的屏幕位置(如位置和维度),因为它正在显示。 如果元素当前不在屏幕上(已经滚动),则负值是可以接受的。 这是一个iPad(WebKit / WebView)应用程序。 每当用户点击一个UIWebView的特殊链接,我应该打开一个popup视图,显示关于链接的更多信息。 弹窗视图需要显示一个箭头,指向调用它的屏幕部分。
我试图得到一个归属string的矩形,但boundingRectWithSize调用不是我传入的大小,并返回一个单一的行高度,而不是一个很大的高度(这是一个长的string)的矩形。 我已经通过传递一个非常大的值的高度,也如下面的代码0,但返回的矩形总是相同的。 CGRect paragraphRect = [attributedText boundingRectWithSize:CGSizeMake(300,0.0) options:NSStringDrawingUsesDeviceMetrics context:nil]; 这是打破了,还是我需要做别的事情,让它返回包装文本rect?
我一直在肖像模式下写我的通用应用程序,现在约15笔尖文件,许多viewCotnrollers,我想实现shouldAutorotateToInterfaceOrientation并devise一些屏幕在横向模式。 join: – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } 到我的所有viewControllers,不做的工作。 在debugging期间,我看到这个方法被调用,但它不会工作! 不在模拟器中,不在设备中,不在Iphone中,不在Ipad中! 我在论坛中search了一些答案,并看到一些build议使用: – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ); } 也没有工作, 添加: [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 和 [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; 到我的viewDidLoad和viewDidUnload分别没有任何工作。 我迷路了..任何帮助都行! 只是一个更多的信息...所有我的意见是typesUIControl,因为我需要TuchUpInside工作。 Appriciate你的帮助。
我在我的应用程序中使用CustomCell实现了TableView, 我想根据UITableViewCell中的文本长度,我的UITableViewCelldynamic高度, 这里是Customcell的快照 :这里是我的UITableView的快照 : heightForRowAtIndexPath代码片段 #define FONT_SIZE 14.0f #define CELL_CONTENT_WIDTH 320.0f #define CELL_CONTENT_MARGIN 10.0f – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; { NSString *text = [DescArr objectAtIndex:[indexPath row]]; CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH – (CELL_CONTENT_MARGIN * 2), 20000.0f); CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap]; CGFloat height = MAX(size.height, 100.0); return height; } 正如您在第二张图片中看到的,单元格的高度是固定的,它不会随文本(内容)大小而改变。 我在哪里犯错? 我怎样才能使标签或单元格根据其内容/文本更新其大小?
在iOS中,我将如何指示操作系统保持我的应用程序运行,即使它不在前台? Skype的 Viber的 Empatica Zenly 还有更多的应用程序这样做。
你如何改变播放本地通知的声音? 我使用下面的代码来播放默认声音: notif.soundName = UILocalNotificationDefaultSoundName; 所以,我在下面尝试了这个,但是没有成功。 我该怎么办? 谢谢你的帮助! notif.soundName = @"sound.caf";
我需要找出的原因是,在iPad上,UIPickerView在横向上的高度与在纵向上的高度相同。 在iPhone上是不同的。 iPad编程指南为UIDevice引入了一个“成语”值: UIDevice* thisDevice = [UIDevice currentDevice]; if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { // iPad } else { // iPhone } 当你在iPad(3.2)而不是iPhone(3.1.3)时工作正常 – 所以它看起来像还需要一个ifdef条件编译检查,如: #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 30200 UIDevice* thisDevice = [UIDevice currentDevice]; if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { // etc. } #endif 对我来说,这看起来非常笨拙。 什么是更好的方法?
我正在创build一个需要login的标签栏控制器的iPad应用程序。 所以在启动时,我想显示一个LoginViewController,如果login成功,然后显示标签栏控制器。 这是我如何实现一个初始testing版本(省略了一些典型的标题等)… AppDelegate.h: @interface AppDelegate_Pad : NSObject <UIApplicationDelegate, LoginViewControllerDelegate> { UIWindow *window; UITabBarController *tabBarController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController; @end AppDelegate.m: @implementation AppDelegate_Pad @synthesize window; @synthesize tabBarController; – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { LoginViewController_Pad *lvc = [[LoginViewController_Pad alloc] initWithNibName:@"LoginViewController_Pad" bundle:nil]; lvc.delegate = self; [window addSubview:lvc.view]; //[lvc […]