这是一个非常新秀的问题.我在底部有一个UIToolBar,当显示UIKeyBoard时,它应该用键盘上下动画.我在UIKeyBoard Notifications的帮助下完成了这项工作.我们正在讨论的视图已启用拆分视图.当设备方向是横向时,两个视图都显示为[希望有意义].
当显示键盘时,我这样做
CGSize keyBoardSize = [[notificationInfo objectForKey:UIKeyboardFrameEndUserInfoKey]CGRectValue].size;
CGRect toolbarFrame= [BottomToolBar frame];
toolbarFrame.origin.y -= keyBoardSize.height;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
BottomToolBar .frame = viewFrame;
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
当键盘是hiiden我这样做
toolbarFrame.origin.y += keyBoardSize.height;
Run Code Online (Sandbox Code Playgroud)
我的问题是当设备方向改变为横向时,当键盘可见时,底部工具栏消失.我看到它快速上升.我不知道如何解决这个问题.有人可以帮忙吗?另外,有没有办法不让键盘跨越分割视图中的两个视图?
objective-c uitoolbar uiview uikeyboard uisplitviewcontroller
编辑添加*我还没有找到这个解决方案,有人可以帮忙吗?我的问题与此类似,但发布的答案对我不起作用 - 引脚移动后MKMapView刷新*结束编辑
我有一个启用搜索的地图视图.当用户点击搜索时,我的自定义注释会添加到地图视图中.搜索返回20个带有"加载更多"链接的结果.当我点击加载更多时,应该在地图视图中添加更多注释.
问题是 - 注释会添加到地图视图中,但不会显示在地图上.如果我放大或缩小以更改地图区域,则会显示引脚.
我发现viewForAnnotations:当我点击'加载更多'时没有被调用.我不知道如何触发这个.任何人?
-(void)completedSearch:(NSNotification *)resultNotification
{
//begin loop
//get coordinate
customAnnotation *annot = [[customAnnotation alloc] initWithCoordinate:coordinate];
//set title subtitle
[annotationsArray addObject:annot];
//end loop
[mView addAnnotations:annotationsArray];
[mView setRegion:region animated:YES];
[mView regionThatFits:region];
}
//custom annotation
@interface customAnnotation : NSObject <MKAnnotation>
{
CLLocationCoordinate2D coordinate;
NSString* title;
NSString* info;
}
@property (nonatomic, retain) NSSting *title;
@property (nonatomic, retain) NSSting *info;
-(id) initWithCoordinate:(CLLocationCoordinate2D)c;
@end
@implementation customAnnotation
@synthesize coordinate, title, info;
-(id) initWithCoordinate:(CLLocationCoordinate2D)c
{
coordinate = c;
return self;
} …Run Code Online (Sandbox Code Playgroud) 我知道这个问题已被多次询问,我确实阅读了有关此主题的现有帖子,但我仍然需要帮助.
我有2个UIViewControllers- 父母和孩子.我UIViewController使用presentModalViewController如下显示孩子:
ChildController *child =
[[ChildController alloc] initWithNibName:@"ChildView" bundle:nil];
[self presentModalViewController:child animated:YES];
[child release];
Run Code Online (Sandbox Code Playgroud)
孩子的观点有一个UIPickerView.当用户从中选择一个项目UIPickerView并单击完成时,我必须关闭模态视图并UITextField在父视图中的a上显示所选项目.
在孩子的按钮单击中delegate,我执行以下操作:
ParentController *parent =
(ParentController *)[self.navigationController parentViewController];
[parent.myTextField setText:selectedText];
[self dismissModalViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
一切正常,没有错误.但我不知道如何加载父视图,以便它显示更新UITextField.
我试过了
[parent reloadInputViews];
Run Code Online (Sandbox Code Playgroud)
不工作.请帮忙.
我需要帮助解除我的自定义对象的NSMutableArray.我需要保留数组,所以我在.h中添加了一个属性,然后在.m文件的dealloc中释放它.当我向数组添加对象时,我执行以下操作:
myarray = [[NSMutableArray alloc] init];
[myarray addObject:[[mycustomObject alloc]initWithObject:obj1]];
[myarray addObject:[[mycustomObject alloc]initWithObject:obj2]];
Run Code Online (Sandbox Code Playgroud)
现在,我不知道如何发布mycustomobject.如果我执行以下操作:
[myarray addObject:[[[mycustomObject alloc]initWithObject:obj1] autorelease]];
Run Code Online (Sandbox Code Playgroud)
我稍后访问数组时会遇到问题.请指教.