ios - Adding a UIButton Programmically to a subview of UINavigationBar and touch events are not registering -


I have a UITableView inside the UINavigationController to create a toolbar at the bottom of the screen which does not grow with table cells , I added a UIView as a subview in the navigation bar.

Then I am making UIButton to add this UIUV to programming. I have added a selector but it is not registering and the function has been called which I set it to (sendMessage).

Any thoughts?

  self.sendBar = [[UIView alloc] InitWithFrame: CGRectMake (0, self.view.frame.size.height-100, self.view.frame.size.width, 100)] ; Self.sendBar.backgroundColor = cloudBlue; UIButton * sendButton = [[UIButton alloc] initWithFrame: CGRectMake (0,0,50,50)]; SendButton.backgroundColor = [UIColor blackColor]; [SendButton addTarget: Self-action: control event for @Selector (sent message): UIControlEventTouchUpInside]; [Self. Navigation Controller Add navigationbar addviewview: self.sendBar]; [Self.sendBar addSubview: sendButton];    

I suspect that there may be something like this that you add buttons As a subview of "Submitbar", but refers to a selector from the main scene. There are two things that you can possibly do here:

1: Create your remittance beer as a custom sub-class of UIView, in which your SendButton has been included as a subview. Then, create a representative for your SendBar and it has been triggered from the main implementation of the SubmitBern implementation.

2: Add sendButton directly to the basic view as a subview, and do not sendBar. UIButton * sendButton = [[UIButton alloc] initWithFrame: CGRectMake (0, self.view.frame.size.height, 50,50)]; SendButton.backgroundColor = [UIColor blackColor]; [SendButton addTarget: Self-action: control event for @Selector (sent message): UIControlEventTouchUpInside]; [Self. Navigation Controller Add navigationbar addviewview: self.sendBar]; [Self.sendBar addSubview: sendButton]; [Self.view addSubview: sendButton];

In addition to this, you may want to fix sendBar to manually send yourself. Do not do it yourself. Controller Navigation Bar if you want to show it at the top of your table view; But I do not know what you are trying to do.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -