【问题标题】:how to scroll a uiwebview using uiscrollview如何使用 uiscrollview 滚动 uiwebview
【发布时间】:2013-11-15 09:43:20
【问题描述】:

我在 UIScrollView 上有一个 UIWebView。我使用一些 js 文件来绘制一些曲线图,当时间值改变时会更新。

问题

当点离开屏幕时,我无法滚动。

我是 IOS 开发新手,所以请帮助我。

提前致谢

【问题讨论】:

    标签: ios cocoa-touch iphone-developer-program


    【解决方案1】:
    After Completion the QUERY, You need to close transaction.
    
    Here's the sample code for you...
    
    // Get the documents directory
       dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    
       docsDir = [dirPaths objectAtIndex:0];
    
    // Build the path to the database file
       databasePath = [[NSString alloc] initWithString: [docsDir stringByAppendingPathComponent: @"YOURDB.db"]];
    
    const char *dbpath = [databasePath UTF8String];
    
    if (sqlite3_open(dbpath, &DB) == SQLITE_OK)
    
        {
    
            NSString *query=[NSString stringWithFormat:@"insert into studentDetails (NAME,Email,adressL1,adressL2,phone,landline,department,DoB,fatherName) values (\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\",\"%@\")",
                                           name.text,
                                           email.text,
                                           addressLine1.text,
                                           addressLine2.text,
                                           phone.text,
                                           Landline.text,
                                           Department.text,
                                           DoB.text,
                                           fname.text];
    
    
    
                const char *insert_stmt = [insertSQL UTF8String];
    
    
    
                sqlite3_prepare_v2(YOURDB, insert_stmt, -1, &statement, NULL);
    
                if (sqlite3_step(statement) == SQLITE_DONE)
    
                {
    
                    NSLog(@" Successfully added");
    
    
    
                } else {
    
                    NSLog(@" Failed added");
    
                    NSLog(@"Error %s",sqlite3_errmsg(ExplorejaipurDB));
    
                }
    
            }
    
    
            sqlite3_finalize(statement);
    
            sqlite3_close(YOURDB);
    
        } 
    

    【讨论】:

      【解决方案2】:

      由于以下几个原因,数据库可能被锁定:

      • 多个查询正在运行
      • 多线程运行
      • 多次打开数据库

      检查您的代码,看看您是否关闭了与数据库的连接sqlite3_close()。一个好主意是在您完成每个 SQL 语句后使用 sqlite3_finalize()

      所以尝试将所有sqlite3_open()sqlite3_close()sqlite3_prepare()(如果您正在使用)与sqlite3_finalize() 匹配

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-10-18
        • 2011-12-03
        • 2014-01-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-12-05
        相关资源
        最近更新 更多