logo
Tags down

shadow

Change barbutton image


By : bleriot11
Date : October 14 2020, 02:21 PM
around this issue You need to resize picked image first. Add below function to resize image:
code :
extension UIImage {

    func resizedImage(newSize: CGSize) -> UIImage? {
        guard size != newSize else { return self }

        let hasAlpha = false
        let scale: CGFloat = 0.0
        UIGraphicsBeginImageContextWithOptions(newSize, !hasAlpha, scale)
        UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0)

        draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height))
        let newImage: UIImage? = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return newImage
    }
}
addAppointmentButton.image = pickedImage.resizedImage(newSize: CGSize(width: 24, height: 24))?.withRenderingMode(.alwaysOriginal)


Share : facebook icon twitter icon

How to put barbutton on UIToolbar?


By : azmiyapar
Date : March 29 2020, 07:55 AM
Any of those help I want to add Toolbar on the upperside of PickerView and want to add one BarButton on the Toolbar Dynamically and on the click event of that button i want to dismiss the Picker as well as toolbar so please help me in this task... in Advance.. , You can create the UIToolBar and its buttons this way -
code :
UIToolbar * toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0f, 324.0f, 320.0f, 44.0f)];
    [toolBar setBarStyle:UIBarStyleBlackTranslucent];

    UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissPicker:)]; 

    [toolBar setItems:[NSArray arrayWithObjects:flexibleSpace, doneBtn, nil] animated:YES];
    [flexibleSpace release];
    [editButton release];

in iPhone SDK How to change the color of BarButton Item


By : Angelo Andelnyr
Date : March 29 2020, 07:55 AM
Hope this helps Create the bar buttom item with a custom view using -[UIBarButtonItem initWithCustomView:]. That way, you have all the control you want over the appearance.

How to add barbutton programmatically with image


By : user2875959
Date : March 29 2020, 07:55 AM
this one helps. I am creating a barbutton programmatically. But it can't fix into screen. Help me in solve this problem.
code :
UIImage *image = [UIImage imageNamed:@"request.png"];    
UIButton* requestButton = [UIButton buttonWithType:UIButtonTypeCustom];
[requestButton setImage:image forState:UIControlStateNormal];
[requestButton addTarget:self action:@selector(requestButton) forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *button2 = [[UIBarButtonItem alloc] initWithCustomView:requestButton];
self.navigationItem.rightBarButtonItem = button2;

bug in my BarButton


By : user3439255
Date : March 29 2020, 07:55 AM
To fix the issue you can do Your add selector has a colon at the end which means it is trying to use an add method with a parameter but your add method does not expect a parameter object. You need to remove the colon from your selector by changing your Bar Button Item allocation to this:
code :
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add)];

UIPickerView BarButton Text Color is not change but when click on button then the color is change in Objective-C


By : user2335558
Date : March 29 2020, 07:55 AM
I hope this helps . I know this question was asked 10 months ago. But today I still had this issue. I tried changing tint color and I have no idea why it is not working. After spending hours, I finally decided to create a UIView on UIToolbar and then add a UIButton on it. It worked for me. I hope it might help someone in future.
code :
// UIPickerView
self.myPickerView = UIPickerView(frame:CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 216))
self.myPickerView.delegate = self
self.myPickerView.dataSource = self
self.myPickerView.backgroundColor = UIColor.white
cell.myTextField.inputView = self.myPickerView

// ToolBar
let toolBar = UIToolbar()
toolBar.barStyle = .default
toolBar.isTranslucent = true
toolBar.tintColor = UIColor(red: 92/255, green: 216/255, blue: 255/255, alpha: 1)
toolBar.sizeToFit()

// UIView
let myNewView=UIView(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 44))
myNewView.backgroundColor = .lightGray
toolBar.addSubview(myNewView)

// UIButton
let button:UIButton = UIButton(frame: CGRect(x: myNewView.bounds.width - 80, y: 0, width: 70, height: 44))
button.setTitle("Done", for: .normal)
button.addTarget(self, action:#selector(self.doneClick), for: .touchUpInside)
myNewView.addSubview(button)

cell.myTextField.inputAccessoryView = toolBar
Related Posts Related Posts :
  • Why does Firestore sometimes not return anything, no error, nothing?
  • How to trigger a segue from a tab bar item to another by clicking a button?
  • How to instantiate a nib into view without a viewcontroller as owner?
  • How can I pass a Post Id to a Comments VC - Swift
  • typealias is not able to use producing Cannot invoke initializer Error
  • Different values for print or console print out
  • How to create TextField for message input with 0 lines?
  • How can I make a cell and its elements look greyed out?
  • What is a viable alternative for a Dictionary for Search applications in Swift?
  • User is already logged in and save data into core data using api
  • Find an element in a stack data structure swift 4
  • Tap Gesture not working as expected when added to uiview in collectionview cell
  • "No WatchKit 1.0 app bundle found for app" Xcode 10.1 Swift 4.2
  • UISearchBar in UITableView by Rxswift
  • Cannot convert value of type '[Int]' to expected argument type 'Int'
  • Table View Height restricted Scroll
  • How to test view controller with XIB file using Quick?
  • Local and Network Data Manager
  • Can not scroll to a row of a section in a tableView
  • Cannot use instance member 'getA' within property initializer; property initializers run before 'self' is available
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org