小编Thy*_*men的帖子

如何生成CSV文件?

我有数据导出到excel它工作正常.但我有一个小问题

我的输出像这样导出:

在此输入图像描述

我想要发生的是:

在此输入图像描述

这是我要导出的代码:

-(void)exportCSV {

    NSArray * data = [NSArray arrayWithObjects:entries,keys, nil];
    NSLog(@"%@",data);
    csv =[NSMutableString string];
    for (NSArray * line in data) {
        NSMutableArray * formattedLine = [NSMutableArray array];
        for ( field in line) {
            BOOL shouldQuote = NO;
            NSRange r = [field rangeOfString:@","];
            //fields that contain a , must be quoted
            if (r.location != NSNotFound) {
                shouldQuote = YES;
            }
            r = [field rangeOfString:@"\""];
            //fields that contain a " must have them escaped to "" and be quoted …
Run Code Online (Sandbox Code Playgroud)

csv export objective-c ios

6
推荐指数
1
解决办法
1485
查看次数

如何添加清除按钮UITextfield?

我想在UITextfield中添加一个清除按钮,但它不显示.

这是UITextfield的代码:

  @implementation databaseEnterDataViewController

@synthesize customer = customer_ ;
@synthesize type = type_ ;
@synthesize code1 = code1_ ;
@synthesize code2 = code2_ ;
@synthesize background,
            changeType,
            codeOne,
            codeTwo,
            customers,
            suspendDisplayInfo,
            tf;


#pragma mark -
#pragma mark Initialization

#pragma mark -
#pragma mark View lifecycle

- (void)viewDidLoad {
    [super viewDidLoad];

    self.customer = @"" ;
    self.type     = @"" ;
    self.code1    = @"" ;
    self.code2    = @"" ;

    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"Save" style:UIBarButtonSystemItemCancel target:self action:nil];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:nil];
    self.navigationItem.title …
Run Code Online (Sandbox Code Playgroud)

iphone button uitableview uitextfield ios

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

如何更改布局视图控制器?

我为iPhone做了一个应用程序,我使用的是UIStoryboard.

当应用程序启动时,我有一个看起来像这样的视图

在此输入图像描述

当我按下Button1标签Code 2:并且textfield必须消失时我尝试了该setHidden方法

这就是发生的事情

在此输入图像描述

但我想要发生的是这个

在此输入图像描述

我该怎么办?

iphone layout uiviewcontroller ios

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