我正在从一个新的视图控制器创建一个popoverSegue,并希望将第三个视图控制器推送到原始堆栈.这就是我创建应用程序的方式:
Single View ApplicationUse StoryboardsMainStoryboard.storyboard文件.Title和Identifier到initialView,然后选择Editor->Embed In->Navigation ControllerView Controller对象从"对象库"拖到画布上Title和Identifier新的视图控制器来:popoverView和newView.Round Rect Button将对象库中的对象添加到initialView和popoverView.Label将对象库中的对象添加到`newView.initialView并拖动到popoverView.Popover从Storyboard Segues显示的菜单中选择选项.popoverView并拖动到newView.Push从Storyboard Segues菜单中选择选项.单击第一个按钮,弹出窗口,但是当您单击弹出窗口中的按钮时,没有任何反应(它应该按下新视图但不会.)
我想要做的是将它推入Navigation Controller堆栈,但我不确定如何设置故事板.
有任何想法吗?
我一整天都在研究这个问题,并在SO和google上看了很多问题,但到目前为止我还没有提出任何正确的问题.
我在运行iOS 5.1.1的iPad上拍了一张照片,并使用照片应用裁剪了它.然后我从资产库中获取它的引用,并获得未裁剪的全分辨率图像.
我发现裁剪信息包含在我对象的AdjustmentXMP键中.metadataALAssetRepresentation
所以我使用XMP信息裁剪照片,这是我得到的:
原始照片(1,936 x 2,592):
正确裁剪的照片,如照片应用程序(1,420 x 1,938)中所示:
使用下面的代码裁剪照片
(也是1,420 x 1,938,但是在右边太远处裁剪了大约200像素):

这是照片中的XMP数据:
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:aas="http://ns.apple.com/adjustment-settings/1.0/">
<aas:AffineA>1</aas:AffineA>
<aas:AffineB>0</aas:AffineB>
<aas:AffineC>0</aas:AffineC>
<aas:AffineD>1</aas:AffineD>
<aas:AffineX>-331</aas:AffineX>
<aas:AffineY>-161</aas:AffineY>
<aas:CropX>0</aas:CropX>
<aas:CropY>0</aas:CropY>
<aas:CropW>1938</aas:CropW>
<aas:CropH>1420</aas:CropH>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
Run Code Online (Sandbox Code Playgroud)
这是我用于裁剪照片的代码:
ALAssetRepresentation *rep = // Get asset representation
CGImageRef defaultImage = [rep fullResolutionImage];
// Values obtained from XMP data above:
CGRect cropBox = CGRectMake(0, 0, 1938, 1420);
CGAffineTransform transform = CGAffineTransformMake(1, 0, 0, 1, 331, 161);
// …Run Code Online (Sandbox Code Playgroud) 我有按钮,当我点击显示相机(完美的工作)
- (IBAction)getPhoto:(id)sender
{
NSLog( @"Button clicked!" );
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
}
else { // IF the device doesn't have a camera, so use the photos album
[imagePicker setSourceType:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
}
[self addSubview:imagePicker.view];
}
Run Code Online (Sandbox Code Playgroud)
之后我可以拍摄图像,等等 - 但是当我点击"使用"时:这里没有任何反应是我的方法:图像选择器没有解雇它的方法:应用程序根本什么都不做,我正试图拍摄我只是的图像将其显示在屏幕上的CGRect中.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissViewControllerAnimated:YES completion:NULL];
UIImageView *patientImage = [[UIImageView alloc] init];
patientImage.frame = CGRectMake(625, 25, 83, 103);
UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
self.patientImage.image = chosenImage;
}
Run Code Online (Sandbox Code Playgroud)
即使我在没有拍摄图像的情况下点击取消按钮,imagePicker(相机界面)也不会自行解除
任何帮助,建议或指导将非常感激.
目前我的代码出现问题,在过去3天内,我无法使用此处记录的Google Places API成功完成删除请求.
直到星期日,只要请求的位置满足API中的条件,此代码就会执行并运行而不会出现问题,并且我收到的唯一响应是OK或REQUEST_DENIED表单.
然而,现在,每当我发送请求时,我收到的唯一响应都是INVALID_REQUEST形式,这至少可以说是非常不方便的.根据我的理解,以及我之前对此代码执行的测试,我遵守他们要求的格式,所以我无法理解为什么这不起作用.
任何人都可以查看此代码并告诉我与链接API相比是否存在任何问题?
public boolean delete(String reference)
{
try
{
System.out.println(reference);
String url = "https://maps.googleapis.com/maps/api/place/delete/xml?sensor=false&key=API_KEY_HERE";
String data = "<PlaceDeleteRequest>\n<reference>" + reference + "</reference>\n</PlaceDeleteRequest>";
System.out.println(data);
URL xmlUrl = new URL(url);
HttpPost request = new HttpPost(xmlUrl.toURI());
request.setEntity(new StringEntity(data));
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(request);
HttpEntity entity = response.getEntity();
BufferedReader input = new BufferedReader(new InputStreamReader(entity.getContent()));
String line = "";
while ((line = input.readLine()) != null)
{
System.out.println(line);
if (line.contains("<status>"))
{
String[] s1 = line.split(">");
String[] …Run Code Online (Sandbox Code Playgroud) 使用溢出的视图控制器时,我有一个主视图和详细信息视图.当iPad处于纵向模式时,主视图将显示为弹出窗口.如何调整masterview(弹出视图)的高度?我试过了:
self.contentSizeForViewInPopover = CGSizeMake(320.0, 2 * 52.0);
Run Code Online (Sandbox Code Playgroud)
但我不确定要设置这个吗?

objective-c ipad uisplitviewcontroller uipopovercontroller ios
我试图通过使用如图所示UIScrollView的UITextField方式更改大小来移动键盘contentInsets.
但是,它不适用于键盘高度.键盘高度为216,但如果我将iPhone底部插图设置为515(iPhone纵向模式)和310设置为iPhone横向模式,它只会停止在正确位置滚动.为什么这些尺寸会如此不同?我不想硬编码这些任意值.
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.frame = self.parentViewController.view.frame;
[self.textView becomeFirstResponder];
NSLog(@"scrollview: %f,%f, parent: %f,%f", self.view.frame.size.height, self.view.frame.size.width, self.parentViewController.view.frame.size.height, self.parentViewController.view.frame.size.width);
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
}
- (void)keyboardWasShown:(NSNotification *)notification
{
if([[UIDevice currentDevice]userInterfaceIdiom]==UIUserInterfaceIdiomPhone) {
// Step 1: Get the size of the keyboard.
CGFloat keyboardHeight = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size.height;
// Step 2: Adjust the bottom content inset of your scroll view by the keyboard height.
UIEdgeInsets contentInsets …Run Code Online (Sandbox Code Playgroud) 我在这里错过了什么吗?看起来Apple提供的方法仅适用于UTC,无论机器的时区默认值或您设置的是什么.
这是我得到的输出:
Output:
2013-02-01 10:41:24.152 Scratch[17640:c07] cal=gregorian, cal.timeZone=America/Los_Angeles (PST) offset -28800
2013-02-01 10:41:24.154 Scratch[17640:c07] date_Feb1_1400PST=2013-02-01 14:00 -0800
2013-02-01 10:41:24.156 Scratch[17640:c07] date_Feb2_1200PST=2013-02-02 12:00 -0800
2013-02-01 10:41:24.157 Scratch[17640:c07] midnights between=1
2013-02-01 10:41:24.158 Scratch[17640:c07] and then...
2013-02-01 10:41:24.159 Scratch[17640:c07] date_Feb1_2000PST=2013-02-01 22:00 -0800
2013-02-01 10:41:24.161 Scratch[17640:c07] date_Feb2_1000PST=2013-02-02 10:00 -0800
2013-02-01 10:41:24.161 Scratch[17640:c07] midnights between=0Run Code Online (Sandbox Code Playgroud)
我真正想知道的是给定时区(本地或其他地方,不一定是UTC)两天之间"有多少个中午"(即多少个日历天差异)
这似乎是一个如此常见且相当简单的问题,我很惊讶地看到它是多么混乱和难以弄清楚.
我不是在寻找一个涉及"mod 86400"的答案或类似的东西.该框架应该能够认真地告诉我这一点.
- (void)doDateComparisonStuff {
NSCalendar *cal = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
cal.timeZone = [NSTimeZone timeZoneWithName:@"America/Los_Angeles"];
NSLog(@"cal=%@, cal.timeZone=%@", cal.calendarIdentifier, cal.timeZone);
NSDate *date_Feb1_1400PST = [self dateFromStr:@"20130201 1400"];
NSLog(@"date_Feb1_1400PST=%@", …Run Code Online (Sandbox Code Playgroud) 我一直在阅读文档,CAShapeLayer但我仍然没有得到它.根据我的理解,Layer它总是扁平的,它的大小总是一个矩形.
CAShapeLayer另一方面,允许您定义不仅仅是矩形的图层.它可以是圆形,三角形等,只要你使用它UIBezierPaths.
我的理解是在这里吗?
我想到的是,例如,一个网球从屏幕边缘反弹(很容易),但我想展示一个不使用图像动画的小动画 - 我希望它显示一点"挤压"喜欢动画,因为它会碰到屏幕的边缘然后反弹.我没有使用网球图像.只是一个黄色的圆圈.
我在这里是否正确CAShapeLayer完成此事?如果是这样,请你提供一个小例子吗?谢谢.
我使用基于拆分视图的应用程序模板创建了一个新应用程序.
然后我将一个Action Button添加到名为actionButton的rootViewController导航控制器中.
按下按钮时,我会显示如下的ActionSheet:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil
otherButtonTitles:@"Admin Functions", @"Refresh Data", nil];
[actionSheet showFromBarButtonItem:actionButton animated:YES];
[actionSheet release];
Run Code Online (Sandbox Code Playgroud)
在横向模式下按下按钮后,它会在指向按钮的弹出框中显示操作表(正如我预期的那样):

但是,在纵向模式下,它看起来完全不同,菜单从rootViewController popover的底部出现,就像在iPhone上一样:

我的问题是,如何在纵向模式下使ActionSheet显示在顶部,就像在横向模式下一样?
由于这是一个"实用程序菜单",它并不直接与显示的数据绑定,因此它不应该是弹出窗口的一部分.
uiactionsheet ipad uisplitviewcontroller uipopovercontroller ios
当我创建一个静态表视图并将其放在普通视图控制器中时,我收到一个错误,指出静态表视图必须在UITableViewController中.
我想要的是iPad上的一个视图,它有一个占据屏幕大部分的静态表格视图,但是它下面的标准UIView始终保持可见,并且有几个标签,我根据表格视图中的内容进行更新.
有没有办法使用UITableViewController并使tableView不是全屏,以便我可以在故事板中添加子视图?
如果不是,可以在代码中完成吗?
任何提示将不胜感激!
ios ×9
ipad ×3
objective-c ×3
storyboard ×2
alasset ×1
cashapelayer ×1
cgimage ×1
cocoa ×1
cocoa-touch ×1
ios5 ×1
java ×1
nsdate ×1
uiimageview ×1
uiscrollview ×1
uitableview ×1
uiview ×1
xcode ×1