小编iPr*_*mer的帖子

检查c#中字符串中的字母数字字符

我使用了以下代码但它返回false虽然它应该返回true

string check,zipcode;
zipcode="10001 New York, NY";
check=isalphanumeric(zipcode)

public static Boolean isAlphaNumeric(string strToCheck)
{
    Regex rg = new Regex("[^a-zA-Z0-9]");

    //if has non AlpahNumeric char, return false, else return true.
    return rg.IsMatch(strToCheck) == true ? false : true;
}
Run Code Online (Sandbox Code Playgroud)

c#

18
推荐指数
5
解决办法
5万
查看次数

PresentModalViewController未在下一个视图上显示导航栏

您好我正在使用工具栏上的一个标签栏按钮,此按钮将显示带有表格视图的下一个视图,这是我的代码

[self presentModalViewController:self.navigationController
                            animated:YES];
Run Code Online (Sandbox Code Playgroud)

我的问题是,当我单击此选项卡栏按钮时,它将显示带有tableview的下一个视图,但不显示导航栏.因为这个我无法在tableView中执行删除操作.

如何解决这个问题?

iphone presentmodalviewcontroller

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

ios6从横向模式到纵向模式的旋转问题

我正在使用ios 6的新定位方法,它工作正常.我的视图以纵向模式呈现,当我呈现viewviewrnoller并将其旋转到横向时,忽略该视图控制器它还原方向.意味着它应该保留在风景中但它变成了肖像.这是我的代码.

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;

}

// Tell the system It should autorotate
- (BOOL) shouldAutorotate {
    return YES;
}

// Tell the system which initial orientation we want to have
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationMaskPortrait;
}
Run Code Online (Sandbox Code Playgroud)

我认为这是因为preferredInterfaceOrientationForPresentation方法,但没有得到解决方案.请帮助!

谢谢 !!

iphone ios6

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

核心数据应用程序是在iphone设备中崩溃

您好我正在设备中测试我的核心数据应用程序,但它在iphone中崩溃并且在模拟器中工作正常.这是我的代码..

- (NSManagedObjectContext *)managedObjectContext {

    if (managedObjectContext != nil) {
        return managedObjectContext;

    }
    NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
    if (coordinator != nil) {
        managedObjectContext = [[NSManagedObjectContext alloc] init];
        [managedObjectContext setPersistentStoreCoordinator:coordinator];
    }
    return managedObjectContext;
}



- (NSManagedObjectModel *)managedObjectModel {

    if (managedObjectModel != nil) {
        return managedObjectModel;
    }
    NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"TouristGuide" withExtension:@"momd"];
    managedObjectModel= [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];    
    NSLog(@"%@", modelURL);
    return managedObjectModel;
}


- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {


    if (persistentStoreCoordinator != nil) {
        return persistentStoreCoordinator;
    }

    NSString *storePath = [[self applicationDocumentsDirectory] stringByAppendingPathComponent:@"TouristGuide.sqlite"]; …
Run Code Online (Sandbox Code Playgroud)

iphone xcode core-data

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

核心数据应用程序在保存数据时崩溃

我正在使用Core数据在数据库中输入歌曲详细信息.我有3个视图..首先是选择歌曲名称及其详细视图以保存数据库中的详细信息..第三个视图是显示已保存的歌曲..我的应用程序正在保存数据,有时会提供异常.

我发现什么时候是异常.如果我选择歌曲并将其保存在数据库中,则可以正确保存.但是当我第一次去第3视图时.Songlistviewcontroller然后打开歌曲并尝试保存它的详细信息它在保存行上给出例外..

011-11-04 11:14:10.578 SongsWithLyrics [259:207] * - [SongsListViewController controllerDidChangeContent:]:发送到解除分配的实例0x5b73b50的消息

这是我保存歌曲的代码

//save song details
- (IBAction)saveDetails:(id)sender {

    NSError *error;
    self.song = [NSEntityDescription insertNewObjectForEntityForName:@"Song" inManagedObjectContext:managedObjectContext];


    [song setValue:songTitleString forKey:@"songTitle"];
    [song setValue:albumNameText.text forKey:@"albumName"];
    [song setValue:artistNameText.text forKey:@"artistName"];
    [song setValue:albumGenreText.text forKey:@"albumGenre"];
    [song setValue:UIImagePNGRepresentation(artworkImageview.image) forKey:@"artworkImage"];


    if (![managedObjectContext save:&error])
    {
        NSLog(@"Problem saving: %@", [error localizedDescription]);
    }



    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Saved" message:@"" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
    [alert show];
    [alert release];

    [self.navigationController popViewControllerAnimated:YES];




}
Run Code Online (Sandbox Code Playgroud)

我坚持这个问题..并且无法理解为什么会发生这种情况.

之前我的应用程序流程是.. SongsListviewController-> Songs-> SaveSongs

它工作得很好..为此.

请帮忙

iphone core-data

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

如何从json字符串中检查null

当JSON响应没有数据时,它将返回Response: [ ].

这是我的代码

NSURL *url = [NSURL URLWithString:urlString];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];


    [request startSynchronous];
    NSError *error = [request error];

    NSString *response =nil;
    if (!error) {
        response = [request responseString];

        NSLog(@"Response: %@",response);
}
Run Code Online (Sandbox Code Playgroud)

我该如何检查响应是否有值?

我试过if([response isEqualToString:@""]|| [response length]==0)但它不起作用.我也试过了if(response == nil);.

iphone json

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

EverNote Api for iphone

嗨,我正在使用Evernote Api for iphone.我从evernote的开发者网站下载了Api.但我不知道如何使用它...任何人都知道这个或有任何链接或例子来理解这个?

iphone evernote

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

通过umbraco中的脚本文件保存表单值

你好我想在数据库中保存umbraco表格的值为此我已经制作了脚本文件,在这个脚本文件中,我创建了保存数据的函数,并在同一个脚本文件中调用了这个函数,这个脚本文件用于宏,我有在我的页面的模板中调用此宏但它不起作用这种方法是否正确或我还有别的东西我的基本目标是在不创建我的usercontrol的情况下将数据保存在数据库中

代码是

@functions
{
    public void AddToCart()
    {
        string con = System.Configuration.ConfigurationManager.AppSettings["umbracoDbDSN"].ToString();
        SqlConnection OnCon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["umbracoDbDSN"].ToString());
        ItemsDataContext db = new ItemsDataContext(con);
        var request = HttpContext.Current.Request;
        string itemcode= request.Form["ItemCode"].ToString();
        string itemname = request.Form["ItemName"].ToString();
        string itemcategory = Request.Form["ItemCategory"].ToString();
        string userid = "Pallavi";
        db.sp_AddItems(userid, itemcode, itemcategory, itemname, 0);


        HttpContext.Current.Session["UserId"] = "Pallavi";
    }
}


@if (!IsPost)
{
    AddToCart();
}
Run Code Online (Sandbox Code Playgroud)

并在模板上调用此宏

<umbraco:Macro Alias="Uc_Cart" runat="server"></umbraco:Macro>
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc umbraco razor

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

Tableview单元格选择问题

您好我正在使用分组表视图并选择具有蓝色选择样式的Tableview的单元格.

但是当选择单元格并转到下一个视图并再次回到上一个视图时,仍然选择单元格,如果我选择另一个单元格,则显示2个单元格已选中.

在我的代码中查看图像及其下方:

在此输入图像描述

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";
    JobViewTableCell *cell = (JobViewTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
            [[NSBundle mainBundle] loadNibNamed:@"iPadJobViewCell" owner:self options:nil];
            cell = self.JobViewcell;
        }
        else {
        [[NSBundle mainBundle] loadNibNamed:@"JobViewTableCell" owner:self options:nil];
        cell = self.JobViewcell;

        }
    }


    [cell setJobID:[NSString stringWithFormat: @"%@",[(Jobs *)[tableArray objectAtIndex:indexPath.row]JobId]]];
    [cell setJobTitle:[NSString stringWithFormat:@"%@",[(Jobs *)[tableArray objectAtIndex:indexPath.row]Title]]];

    NSString *newDate =[NSString stringWithFormat:@"%@",[(Jobs *)[tableArray objectAtIndex:indexPath.row]Date]];

    NSDateFormatter *dateFormat = …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview

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