Go Premium for a chance to win a PS4. Enter to Win

x

Swift Programming

Swift is a compiled programming language created for iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. Swift is designed to work with Apple's Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C code written for Apple products. Swift is intended to be more resilient to erroneous code ("safer") than Objective-C and also more concise. It is built with the LLVM compiler framework included in Xcode 6 and later and uses the Objective-C runtime, which allows C, Objective-C, C++ and Swift code to run within a single program. A second free implementation of Swift targets Microsoft's Common Language Infrastructure (a.k.a. .NET) and the Java/Android platform.

Share tech news, updates, or what's on your mind.

Sign up to Post

IOS 11, xcode 9

   
// Creating view controller for a new contact
        ABNewPersonViewController *c = [[ABNewPersonViewController alloc] init];
        [c setNewPersonViewDelegate:self];
        [c setDisplayedPerson:person];
        CFRelease(person);
        [self.navigationController pushViewController:c animated:YES];
        [c release];


    - (void)newPersonViewController:(ABNewPersonViewController *)newPersonView didCompleteWithNewPerson:(ABRecordRef)person {
        if (person) {
            ABAddressBookRef addressBook = ABAddressBookCreate();
            ABAddressBookAddRecord(addressBook, person, nil);
            ABAddressBookSave(addressBook, nil);
            CFRelease(addressBook);
        }
        [self.navigationController popViewControllerAnimated:YES];
    }

i'm getting error ABNewPersonViewController is not navigation controller.
[i]
[CNUI WARN] <CNContactViewController: 0x7f984b9a6400> is added to a controller that's not a navigation controller, we'll update the parent navigation item <ABNewPersonViewController: 0x7f984b12d430> automatically[/i]

Open in new window

1
Ask an Anonymous Question!
LVL 11
Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

in IOS application using xcode 9 how to replace  addressbook framework to contacts framework so we can support IOS 8 or above?  

I'm using below code I want to used below code using contact framework

    ABNewPersonViewController *c = [[ABNewPersonViewController alloc] init];
    [c setNewPersonViewDelegate:self];
    [c setDisplayedPerson:person];
    CFRelease(person);
    [self.navigationController pushViewController:c animated:YES];
}
0
Hi, I have a UIPickerView with 2 images in each row, I would like to animate one of the images when it is selected ...I have been able to animate the whole pickerview when the selection changes (in didSelectRow), but I want to just animate one of the images

with the code below ...in the didSelectRow function how would I reference the selected "firstImage" image to apply the animation?

Instead of memoryPicker.transform I've tried...

pickerView.firstImage.transform -  which gives error: Value of type 'UIPickerView' has no member 'firstImage'
And
view.firstimage.transform -  gives error: Value of type 'UIView' has no member 'firstImage'
Thanks

[code]@IBOutlet weak var memoryPicker: UIPickerView!

func numberOfComponents(in pickerView: UIPickerView) -> Int {
    return 1
}

// The number of rows of data
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {

    return objectsToRemember.count
}

func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat {
    return 100
}

func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {

    let view = UIView(frame: CGRect(x: 0, y:0, width: 250, height: 100))

    let firstImage = UIImageView()
        firstImage.image = UIImage(named:objectsToRemember[row])
        firstImage.frame = CGRect(x: 0, y: 0, width: 100, height: 100)

    let secondImage = …
0
I am trying to run code in swift when a textField (in macOS) changes. I have tried:

    override func viewDidLoad() {
        super.viewDidLoad()

        let name = "NSNotificationTextFieldChanged"
        NotificationCenter.default.addObserver(self, selector: Selector(fieldTextDidChange),
            Notification(name: Notification.Name(rawValue: name)), object: nil)
       
    }
   
    func fieldTextDidChange(notification: NSNotification) {
        errorMessage.stringValue = ""
        errorMessage.isHidden = true
    }

but I get the error "Cannot convert value of type '(NSNotification) -> ()' to expected argument type 'String'

Any ideas?
0

Swift Programming

Swift is a compiled programming language created for iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. Swift is designed to work with Apple's Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C code written for Apple products. Swift is intended to be more resilient to erroneous code ("safer") than Objective-C and also more concise. It is built with the LLVM compiler framework included in Xcode 6 and later and uses the Objective-C runtime, which allows C, Objective-C, C++ and Swift code to run within a single program. A second free implementation of Swift targets Microsoft's Common Language Infrastructure (a.k.a. .NET) and the Java/Android platform.

Top Experts In
Swift Programming
<
Monthly
>