小编ftw*_*ere的帖子

在UINavigationController中推送另一个View?

如何使用导航控制器中的按钮推送视图?我试着效仿这个例子:http: //www.cimgf.com/2009/06/25/uitabbarcontroller-with-uinavigationcontroller-using-interface-builder/

这正是我需要的,我有一个UITabBarController4个标签,其中一个是UINavigationController.我想从第一个视图推送包含导航控制器的视图 - 这很简单UIView.它不起作用,我尝试使用以编程方式创建的按钮,没有任何反应.有什么指针吗?

这是我的代码

@interface HomeViewController : UIViewController {

}

-(IBAction)pushViewController:(id)sender;

@end

---

#import "HomeViewController.h"
#import "NewViewController.h"

@implementation HomeViewController

-(IBAction)pushViewController:(id)sender {
        NewViewController *controller = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil];
    [[self navigationController] pushViewController:controller animated:YES];
    [controller release], controller = nil;
}
Run Code Online (Sandbox Code Playgroud)

这里也是连接的屏幕截图 http://imageshack.us/photo/my-images/847/screenshot20110719at620.png/

我已经尝试过你们建议但仍然没有,按钮(无论是创建Interface Builder还是编程)都表现得像是没有链接到任何方法.

iphone xcode uitabbarcontroller uinavigationcontroller

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

NSString新行在邮件中不起作用?

当用户发送邮件时,我想要显示两个UITextView.问题是我希望第二个textview中的文本显示在邮件的新行中.

我已经尝试过使用NSLog,它在那里工作得很好,邮件API有问题或为什么不能正常工作?

我的代码看起来像这样:

NSString *desc = descriptionTextView.text;
NSString *ingredients = ingredientsTextView.text;
NSString *emailBody = [NSString stringWithFormat:@"%@\n\n%@", desc, ingredients];
NSLog(@"%@\n\n%@", desc, ingredients);

-(void)displayComposerSheet 
Run Code Online (Sandbox Code Playgroud)

{MFMailComposeViewController*picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self;

[picker setSubject:titleLabel.text];
NSString *desc = descriptionTextView.text;
NSString *ingredients = ingredientsTextView.text;
NSString *emailBody = [NSString stringWithFormat:@"%@\n\n%@", desc, ingredients];
NSLog(@"%@\n\n%@", desc, ingredients);
[picker setMessageBody:emailBody isHTML:YES];


[self presentModalViewController:picker animated:YES];
[picker release];
Run Code Online (Sandbox Code Playgroud)

}

- (void)viewDidLoad {
titleLabel.text = [recipeData valueForKey:@"title"];
descriptionTextView.text = [recipeData valueForKey:@"description"];
ingredientsTextView.text = [recipeData valueForKey:@"ingredients"];
[super viewDidLoad];
Run Code Online (Sandbox Code Playgroud)

}

iphone nsstring mfmailcomposer

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

AVAudioPlayer泄漏了吗?

我有一个问题,不知道如何处理它.Tyring用声音和动画构建应用程序.它给了我1级然后2级内存警告.我试过构建和分析,我得到了所有这些潜在的泄漏.如果我释放音频,声音将无法播放.任何提示?

这是代码的一部分和我得到的漏洞

    - (IBAction)playsound2
    {
        NSString *path = [[NSBundle mainBundle] pathForResource:@"cat" ofType:@"mp3"];
        AVAudioPlayer* theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; 
        *- **Method returns an Objective-C object with a +1 retain count (owning reference)***
        theAudio.delegate = self;
        [theAudio play];

        ***-  Object allocated on line 302 and stored into 'theAudio' is no longer referenced after this point and has a retain count of +1 (object leaked)***


        cat1.hidden = 0;
        cat.hidden = 1;
        [cat1 startAnimating];
        cat.center = cat1.center;
        [self performSelector:@selector(loadAnimations) withObject:nil afterDelay:1.0];
        catLabel.hidden …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c avaudioplayer ios

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