小编Alb*_*lby的帖子

如何推送视图,返回并返回视图?

我想构建一个用于在iPhone上播放本地音频文件的应用程序但我仍然坚持使用我的一些代码.我想知道如何推送视图,回到uitableviewcontroller并使用一个按钮(如媒体播放器中的"NOW PLAYING"按钮)返回视图,而不会将任何新字符串推入其中.

谢谢

我应该从我的代码中更改什么?

在uitableviewcontroller ..

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
    *)indexPath  {  
selectedSong = [directoryContent objectAtIndex:indexPath.row];  
NSString *storyLin = [[directoryContent objectAtIndex:[indexPath row]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];  
patch = [NSString stringWithFormat:@"/%@", storyLin];


        myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@"mPlayerViewController" bundle:nil];    
myDetViewCont.myProgLang = selectedSong; // assigning the correct value to the variable inside DetailViewController
        [self.navigationController pushViewController:myDetViewCont animated:YES];
        [myDetViewCont release]; // releasing controller from the memory

    }
Run Code Online (Sandbox Code Playgroud)

在mPlayerViewController.m中

-(IBAction) backtoplayer{
    myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@"mPlayerViewController" bundle:nil];
}
Run Code Online (Sandbox Code Playgroud)

iphone xcode uitableview uinavigationcontroller pushviewcontroller

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

如何使用asihttprequest跟踪单个下载速度

有人可以用asihttprequest帮我吗?

我想跟踪我下载的每个文件的速度下载,而不是所有文件的平均速度.

对于所有下载的平均速度,[ASIHTTPRequest averageBandwidthUsedPerSecond] 我可以使用什么来跟踪每次下载?

谢谢

iphone performance request asihttprequest ios

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

触摸并下拉视图

我在界面顶部(状态栏下方)有一个uiview,只显示它的底部.

实际上,我想让红色uiview向下滑动以完全显示拖动,例如本机iOS中的notificationcenter,而不仅仅是通过点击按钮.

我应该用什么来"触摸和拉下"uiview,以便完全显示?

例

iphone uitabbarcontroller uinavigationcontroller ipad ios

5
推荐指数
2
解决办法
4486
查看次数

如何从表中删除单元格

我使用asihttprequest下载文件,但是当下载失败时,与表中文件关联的单元格不会从tableview中删除.

当我滑动删除时,我有这个错误:

*由于未捕获的异常'NSRangeException'终止应用程序,原因:'* - [NSMutableArray objectAtIndex:]:索引0超出空数组的边界'

我该如何移除细胞?

MANAGER.h

NSMutableArray *contentArray;
Run Code Online (Sandbox Code Playgroud)

MANAGER.m

- (id)initWithStyle:(UITableViewStyle)style {
if (self == [super initWithStyle:style]) {

     self.navigationController.navigationBar.tintColor = [UIColor blackColor];
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
    contentArray = [[NSMutableArray alloc] init];
    progArray = [[NSMutableArray alloc] init];
    self.view.backgroundColor = [UIColor clearColor];

    //saveTo = [[NSUserDefaults standardUserDefaults] stringForKey:@"save_to"];

    AppDelegate_iPhone* delegate = (AppDelegate_iPhone *)[[UIApplication sharedApplication] delegate];
    if([delegate saveTo] != nil)
    {
        saveTo = [delegate saveTo];
    }

    if(saveTo == nil)
    {
        saveTo = @"/";
    }


    allFiles = [[NSMutableArray alloc] init];
    NSDirectoryEnumerator *dirEnum = [ …
Run Code Online (Sandbox Code Playgroud)

xcode uitableview asihttprequest ios

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

NSMutableArray和valueforkey的问题

我使用plist文件来获取显示在tableview中的站点列表

plist看起来像这样:

   <array>
        <dict>
            <key>site</key>
            <string>http://yahoo.com</string>
            <key>title</key>
            <string>Yahoo</string>
        </dict>
        <dict>
            <key>site</key>
            <string>http://google.com</string>
            <key>title</key>
            <string>Google</string>
        </dict>
//...etc
    </array>
    </plist>
Run Code Online (Sandbox Code Playgroud)

我没有问题地显示:

    NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"TestData" ofType:@"plist"]];  
        [self setContentsList:array];
Run Code Online (Sandbox Code Playgroud)

*问题是当我尝试搜索内容并且我想从搜索结果中获取valueforkey @"site"以在didSelectRowAtIndexPath中使用它:*

    NSMutableArray *contentsList;   
    NSMutableArray *searchResults;
    NSString *savedSearchTerm;
---------------------
- (void)handleSearchForTerm:(NSString *)searchTerm
{


    [self setSavedSearchTerm:searchTerm];

    if ([self searchResults] == nil)
    {
        NSMutableArray *array = [[NSMutableArray alloc] init];
        [self setSearchResults:array];
        [array release], array = nil;
    }

    [[self searchResults] removeAllObjects];

    if ([[self savedSearchTerm] length] != 0)
    {
        for (NSString *currentString in …
Run Code Online (Sandbox Code Playgroud)

iphone xcode uiwebview nsmutablearray uisearchdisplaycontroller

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