Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-14-2010, 11:00 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 5
SenorWhite is on a distinguished road
Default mediaplayer/strings/views

Hi everyone,
I'm passing strings from one view to anothers buttons and image views but I've been stuck on how to pass a string to a mediaplayer.

I basically have several buttons in view1 that push in view2.
view2 has a mediaplayer and it needs to play a different audio file depending
on which button was pushed in view 1. I'm not entirely sure the best way to go about it or how to go about it for that matter.
Maybe passing a string to the second view and use a :@"%@", musicstring];
in the player?

I've been stuck for a few days, Please Help!

Here's the code for the first view-
- (IBAction)pressedb1view {

if (thebutton.tag==101) {

[self performSelector:@selector(dismissb1pop withObject:nil afterDelay:0.1];
b1view.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:b1view animated:YES];
[b1view changeSiteText:@"my text"];


for the second view in the .h I have-

- (IBAction) changeSiteTextNSString *)str;

and in the .m-

- (IBAction) changeSiteTextNSString *)str{
lblSiteTxt.text = str;

}



-(void)viewWillAppearBOOL)animated {

[[self navigationController] setNavigationBarHidden:NO animated:YES];


NSString *urlStr = [[NSBundle mainBundle] pathForResource:@"music1" ofType:@"mp3"];
NSURL *url = [NSURL fileURLWithPath:urlStr];
//NSURL *movieURL = [NSURL URLWithString:self.movieURLTextField.text];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[self.view addSubview:moviePlayer.view];
moviePlayer.view.frame = CGRectMake(0, 0, 320, 40);





[moviePlayer play];

}
SenorWhite is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, mediaplayer, strings, views and controls

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 373
7 members and 366 guests
apatsufas, Kirkout, lzwasyc, MarkC, Sami Gh, SamorodovAlex, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:43 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0