I have a table view that presents mp3s from a podcast. One option I have when clicking on a row is to allow downloading of the mp3 to the app. When this happens, I have a BarButtonItem containing a ProgressView in the NavigationItem. The BarButtonItem stays hidden until a download starts, and then the progressview shows how much is downloading. I would also like to add a label here to show the name of what is being downloaded. Any suggestions?
Here is what I have in code:
In viewDidLoad:
When the download starts:
My header has this declared as
I then synthesize it. The TableView Controller as I said, is not the root view of the navigation controller, and it has its own .xib. In that .xib, I tried adding a Navigation Bar as an outlet, and connecting everything, but the label did not appear once a download started (although the aforementioned progressview did). I then opened MainWindow.xib and added a TableViewController and set the class to match my code, as well as the NIB Name. I then selected it, went to inspector, and dragged from thebar to the NavigationBar in the Root View Controller of the xib. This also didn't work, though the progress view did show. Am I Missing something obvious?
Solved: It was something obvious:
Here is what I have in code:
In viewDidLoad:
Code:
CGRect frame = CGRectMake(210, -18, 110, 44);
downloadlabel = [[UILabel alloc]initWithFrame:frame];
downloadlabel.textAlignment = UITextAlignmentCenter;
downloadlabel.textColor = [UIColor blackColor];
downloadlabel.backgroundColor = [UIColor clearColor];
downloadlabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:(12.0)];
Code:
[thebar addSubview:downloadlabel];
Code:
{...IBOutlet UINavigationBar *thebar...}
@property (nonatomic, retain) IBOutlet UINavigationBar *thebar;
Solved: It was something obvious:
Code:
[self.navigationController.navigationBar addSubview:downloadLabel];
Last edited: