如何从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)
谢谢.
我正在构建一个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)设置为横向.如何解决此警告消息?
这看起来很奇怪……我在 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)