小编sou*_*ark的帖子

从NSString中删除开始和尾随的新行字符

如何从NSString 中删除开始和尾随新行\n.

例如

@"\n\n\n\Hi\nHow are you\nToday.\n\n\n\n"
Run Code Online (Sandbox Code Playgroud)

输出:

@"Hi\nHow are you\nToday."
Run Code Online (Sandbox Code Playgroud)

谢谢.

cocoa-touch objective-c nsstring

20
推荐指数
2
解决办法
1万
查看次数

不推荐使用两阶段旋转动画.此应用程序应使用更平滑的单阶段动画

我正在构建一个ipad应用程序.当应用程序启动时,我以横向右模式显示它.但是一旦应用程序启动,我就会收到此消息

Two-stage rotation animation is deprecated. This application should use the smoother single-stage animation
Run Code Online (Sandbox Code Playgroud)

我在所有课程中都使用了这种方法

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Run Code Online (Sandbox Code Playgroud)

我还在plist文件中将支持的界面方向(iPad)设置为横向.如何解决此警告消息?

ipad uiinterfaceorientation ios5.1

13
推荐指数
2
解决办法
1万
查看次数

12 月 31 日的 UIDatePicker 问题

这看起来很奇怪……我在 actionSheet 中使用了 UidatePicker。单击一个按钮,我会显示操作表。当我选择日期为 2012 年 12 月 31 日并单击完成时,我得到的日期是 2013 年 12 月 31 日。它发生在所有年份,仅在 12 月 31 日发生。我做错了什么吗?这是我的代码

-(void)dateButtonPressed:(id)sender //Method invoking the action sheet on button press
{
actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];

CGRect pickerFrame = CGRectMake(0, 40, 0, 0);

closingdatePicker = [[UIDatePicker alloc] initWithFrame:pickerFrame];
closingdatePicker.tag=10;
closingdatePicker.datePickerMode=UIDatePickerModeDate;


pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
pickerToolbar.barStyle = UIBarStyleBlackTranslucent;
[pickerToolbar sizeToFit];

NSMutableArray *barItems = [[NSMutableArray alloc] init];

UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(DatePickerCancelClick:)]; …
Run Code Online (Sandbox Code Playgroud)

nsdate uidatepicker ios5

0
推荐指数
1
解决办法
175
查看次数