小编C.J*_*hns的帖子

SVProgressHUD如何延迟指定的时间量

我正在使用第三部分UIActivityIndi​​cator SVProgressHUD,当我的视图加载时,我正在进行这项工作.我希望延迟activityIndi​​cator大约1秒,同时我的应用程序中的一些事情发生.然后调用[SVProgressHUD dismiss]; 基于1秒等待......但我不知道该怎么做.

目前这是我的代码在viewdidload中的样子

[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeBlack];
    [SVProgressHUD setStatus:@"loading..."];   

    [SVProgressHUD dismiss];
Run Code Online (Sandbox Code Playgroud)

我知道有一个dismisswithsucsess:计时器..但这似乎延迟了我不想要的成功消息出现的时间..我想延迟指标,没有文字..但只是想不到一种方法.

我试过了

sleep(1); //which dosnt work 
Run Code Online (Sandbox Code Playgroud)

我也试过了

//[SVProgressHUD performSelector:@selector(stopAnimating) withObject:nil afterDelay:0];
Run Code Online (Sandbox Code Playgroud)

并把[SVProgressHUD解雇]; 在stopAnimating方法中,但是因为看起来所有的调用都需要在同一个方法中.

iphone uiactivityindicatorview ios svprogresshud

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

UITableview Section标题不显示文本

我已将此代码添加到我的UITableViewController以返回灰色标题部分.

- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 
{
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)];
   [headerView setBackgroundColor:[UIColor grayColor]];
    return headerView;
}
Run Code Online (Sandbox Code Playgroud)

但是现在这样做我看不到标题字符...我需要将其添加为子视图吗?还是有另一种做事方式?

我有这些方法将标题和标题文本添加到UITablView但是当我使用上面的方法时,我再也看不到它们了.

// Section headers
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 
{    
    return [sectionLetterArray objectAtIndex:section];
}

// Section header titles
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
    return sectionLetterArray;
}
Run Code Online (Sandbox Code Playgroud)

iphone uitableview ios

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

coredata setFetchBatchSize

我想知道为什么在使用从coredata db获取数据时使用setFetchBatchSize以及它的好处是什么.我目前只是将一个NSData blob放入我的coredata数据库中,所以我想知道它是否适用于我,或者它是否适用于nsarray或类似的东西.

我已经阅读了它在苹果文档中所说的内容,但它还没有多少继续下去.

接收器的批量大小.批处理大小0被视为无限,这将禁用批处理错误行为.

dos not help很多..目前我已经禁用了setFetchBatchSize,一切似乎仍然有效,但我想知道如果我启用它是否可以从中受益.

iphone core-data ios

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

为自定义单元格设置uitableviewcell高度

我希望根据您在Interface Builder中设置自定义单元格的值动态设置单元格高度.这没有用,所以我继续前进并在Apples文档中找到了可用于设置单元格高度的方法 - tableView:heightForRowAtIndexPath:

但是我不确定我是否正确使用它,因为我的tableviewcells没有调整它们的高度它们都保持相同的标准尺寸.这是我在这里使用的代码.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    // Set cell height
    [self tableView:tableView heightForRowAtIndexPath:indexPath];

    // Configure the cell using custom cell
    [[NSBundle mainBundle] loadNibNamed:@"CustomcellA" owner:self options:nil];
    cell = customcellA; // customcellA getters and setters are set up in .h

    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 44;
}
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激

cocoa-touch objective-c uitableview ios

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

以编程方式将UILabel添加到工具栏

我试图以UILabel编程方式添加到我的,UIToolBar但它似乎似乎没有出现.这就是我对我的代码所做的事情.

- (void) viewWillAppear:(BOOL)animated 
{
    // Create custom toolbar at top of screen under navigation controller
    [matchingSeriesInfoToolBar setFrame:CGRectMake(0, 60, 320, 30)];  
    matchingSeriesInfoToolBar = [UIToolbar new];
    [matchingSeriesInfoToolBar sizeToFit];
    CGFloat toolbarHeight = 30;
    CGRect mainViewBounds = [[UIScreen mainScreen] applicationFrame];
    [matchingSeriesInfoToolBar setFrame:CGRectMake(CGRectGetMinX(mainViewBounds), 0, CGRectGetWidth(mainViewBounds), toolbarHeight)];
    matchingSeriesInfoToolBar.tintColor = [UIColor darkGrayColor];
    [self.view addSubview:matchingSeriesInfoToolBar];

    // Create size of uitableview (to fit toolbar.
    [matchingSeriesTableView setFrame:CGRectMake(0, 30, self.view.frame.size.width, self.view.frame.size.height - 30)];
    [self.view addSubview:matchingSeriesTableView];

    // Ad UILabel to the toolbar
    UIBarButtonItem *textFieldItem = [[UIBarButtonItem alloc] …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview uitoolbar uilabel ios

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

试图删除数据库,但说数据库dosnt存在,甚至认为我可以使用它

发生了这个奇怪的错误我正在尝试清理我没有使用的数据库.但是,当我尝试删除mysql时,它说数据库dosnt存在,但是我可以使用它!奇怪还是什么?!从我的列表中删除这个数据库的任何方式.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> use test;
Database changed
mysql> drop mysql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql' at line 1
mysql> drop database mysql;
ERROR 1146 (42S02): Table 'mysql.proc' doesn't exist
mysql> …
Run Code Online (Sandbox Code Playgroud)

mysql macos mysql-error-1064 mysql-error-1146 mysql-error-1007

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

自定义uitableviewcell的问题

我过去几天一直在玩桌面视图,试图习惯他们,今天我一直在尝试创建一个自定义的uitableviewcell,我正在使用Apple文档中的Table View编程指南,并且遇到了这个奇怪的问题我想做.

我已经设置了一个自定义单元格nib文件,它上面有两个标签,它们都有标签(0和1)我已经将File owner类更改为将使用它的nib.

从那里我开始编写tableView:cellForRowAtIndexPath:方法,在tableview中显示我的自定义单元格,但正如您将看到的,当我为其分配字符串时,只有我的第一个标签显示,我只是不知道为什么...

自定义单元格笔尖 在此输入图像描述

tableView:cellForRowAtIndexPath:方法

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"Cell";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease];
            [[NSBundle mainBundle] loadNibNamed:@"ManufactureSearchCell" owner:self options:nil];
            cell = vehicleSearchCell;
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            self.vehicleSearchCell = nil;
        }
        // Configure the cell...
        cell.selectionStyle = UITableViewCellSelectionStyleNone;

        if(indexPath.section == 0)
        {
            if(indexPath.row == 0)
            {
                UILabel *label;
                label = (UILabel *)[cell viewWithTag:0];
                label.text = [[NSString alloc] initWithString:@"Manufacture :"];

                label …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview uilabel ios

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

如何使用XMLParser委托解析XML属性

在这里变得非常沮丧..我怎么解析那些在其中有属性的xml ..我完全迷失了,

这就是我试图解析的xml看起来像..

<Rows>
<Row SKATERID="706" MANUFACTURER="A-DZG" ISFACT="F" ISSKATE="F"/>
<Row SKATERID="318" MANUFACTURER="A.R.E." ISFACT="F" ISSKATE="T"/>
//...
</Rows>
Run Code Online (Sandbox Code Playgroud)

iphone nsxmlparser nsobject ios

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

如何重命名xcode项目文件

可能重复:
如何在Xcode中重命名项目?

嗨,我想要更改我的xcode项目所在的文件的名称.但是当我尝试执行此操作时,我将项目加载到导航器菜单中的所有文件名后变为红色...

更新的问题,我能够重命名我的项目,但它没有改变这一点 在此输入图像描述

它仍然显示testtable2 ...我不知道为什么..是因为整个项目所在的文件夹名称?

iphone xcode ios

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

如何在iphone上缓存xml数据

我正在尝试使用ASIHTTPRequest库中的ASIDownloadCache.我想我几乎已经设置了但是我打印到日志的数据是一堆数字..我认为这可能是一个格式化问题..但我想先把它带到一个有更多经验的人那里来确保我正确地做了,然后希望帮助我解决问题.

下面的代码向您展示了我如何设置我的缓存,我将这个视图用于多个数据集,因此需要使用if语句,以便我只在特定数据上设置缓存.

- (IBAction)setRequestString:(NSString *)string
{
    //Set database address
    NSMutableString *databaseURL = [[NSMutableString alloc] initWithString:@"http://***.***.***.***:8888/codeData/"]; // iphone development

    //PHP file name is being set from the parent view
    [databaseURL appendString:string];

    //call ASIHTTP delegates (Used to connect to database)
    NSURL *url = [NSURL URLWithString:databaseURL];

    checkDataSet = [[NSString alloc] initWithFormat:string];  //Loads ICMfg.xml into checkDataSet for setting up cache

    //Create If statments here
    if ([checkDataSet isEqualToString:@"ICMfg.xml"]) {     

        //Cache stuff goes in here
        ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
        [request setDownloadCache:[ASIDownloadCache sharedCache]];
        [request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy];
        [request …
Run Code Online (Sandbox Code Playgroud)

iphone asihttprequest ios

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

NSURLRequest缓存无法正常工作

我正在尝试缓存我的nsurlrequest数据.在此之前,我成功地从服务器下载数据,自从我尝试实现此缓存以来,它一直在使我的应用程序崩溃.我希望有人可以看看我到目前为止的代码,并帮助我让它工作..我想我已经完成了大约95%.

- (IBAction)setRequestString:(NSString *)string
{
    //Set database address
    NSMutableString *databaseURL = [[NSMutableString alloc] initWithString:@"http://127.0.0.1:29/"]; // imac development


    //PHP file name is being set from the parent view
    [databaseURL appendString:string];

    //call ASIHTTP delegates (Used to connect to database)
    NSURL *url = [NSURL URLWithString:databaseURL];

    //SynchronousRequest to grab the data, also setting up the cachePolicy
    NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:60.0]; //if request dose not finish happen within 60 second timeout.

    //This nsdata will be used to put the cache into
    NSData …
Run Code Online (Sandbox Code Playgroud)

iphone nsurlconnection nsurlrequest ios

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

如何在目标c中声明常量

我需要在我的应用程序中声明两个不同的常量,一个是简单的字符串,另一个需要是uint32.

我知道有两种不同的声明常量的方法如下

#define VERSION 1; //I am not sure how this works in regards to uint32.. but thats what I need it to be.
Run Code Online (Sandbox Code Playgroud)

NSString * const SIGNATURE = @"helloworld";
Run Code Online (Sandbox Code Playgroud)

有没有办法做一个应该是uint32的版本,如下面的nsstring decliration?

比如说像

UInt32 * const VERSION 1;
Run Code Online (Sandbox Code Playgroud)

如果是这样的话?如果没有,我如何确保#define版本的类型为uint32?

任何帮助,将不胜感激

iphone ios

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

自定义节标题uilabel背景和文本

我目前正在创建自己的自定义节标题,但我从来没有通过代码进行任何文本编辑..我用来填充自定义标题的新方法正在做一些奇怪的事情,如图所示在此输入图像描述 下面

我想将文本更改为白色,稍微更大胆,并使白色背景透明..

这是我用来执行此操作的代码

- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 
{
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)];
    [headerView setBackgroundColor:[UIColor grayColor]];

    // Add the label
    UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.5, 20, 20)];

    // do whatever headerLabel configuration you want here


    headerLabel.text = [self tableView:tableView titleForHeaderInSection:section];
    [headerView addSubview:headerLabel];

    // Return the headerView
    return headerView;
}
Run Code Online (Sandbox Code Playgroud)

我试过这个

[headerLabel.backgroundColor:[UIColor clearColor]];
Run Code Online (Sandbox Code Playgroud)

等但它不工作:(

iphone uitableview ios

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