what is EKEvent on iPhone? - objective-c

I want to ask a question about the iPhone application.
I read the document published by Apple
However, I have not idea of the EKEvent, can anyone explain more to me? Thank you very much.

The EKEvent and eventWithEventStore is used to add/modify events in your calendar app. Use its properties to get/set event's title and descriptions.
An EKEvent object represents an event added to a calendar in Event Kit.
Use the eventWithEventStore: method to create a new event. Use the properties in the class to get and modify certain information about an event.
You can add and remove alarms from an event with the addAlarm: and removeAlarm: methods.
Maybe you can tell me what you would like to do?

Related

User Control which triggers GeneXus events in iOS

I'm developing an iOS User Control for Genexus X Ev3, is based on Maps an inherits from GXControlGridBase, the main function is to select a point in the map and return the geolocation updating Genexus attribute and launching an event showing a message with the coordinates stored in the attribute.
Searching I found this:
1- in control definition, .control file defines an event
<Events>
<Event>EventName</Event>
</Events>
2- in Genexus code
Event Control.EventName
...
EndEvent
3- To trigger from Objective-C
[self fireControlEvent:#"EventName" userInterfaceContext:nil withEntityData:nil];
Steps 1&2 are ready (and they work, there is a UC version for Android).
In case of Objective-C ¿where I can put that line? ¿how update the genexus attribute value?
Thanks in advance.
To select a point in a map, you can use the SD Geolocation user control that is built-in in GeneXus.
If you, however, want to make your own user control, you'll probably want to make it a subclass of GXControlEditableWithLabelBase or GXControlEditableWithLabelSingleEditorViewBase. That is, given that you want it to have an associated attribute. You say you are using a GXControlGridBase subclass, that is for lists of values, not just an attribute.
As for the last part of your question, if you need to update the attribute's value, there is no need to trigger an event. You can call this method from the control's implementation:
[self updateEntityDataResolvedFieldWithValue:fieldValue];
The method -updateEntityDataResolvedFieldWithValue: is defined in the GXControlEditableWithLabelBase base class.

How do you know what methods to use for a task?

I am learning Objective-C Cocoa programming for OS X, and object-based programming in general, so I am a big novice here, so my question is a bit general and my guess is the answer to this is simply "experience"; however, I am curious if there is some route of knowledge to understanding what methods in various classes are best or perhaps required for getting tasks done.
For example, in a programming guide I am instructed to create a document-based program, and the document class contains an array to store data, with the following method bound to a button to create a new entry in the array:
- (IBAction)insertItem:(id)sender {
if (!theItems) {
theItems = [NSMutableArray array];
}
[theItems addObject:#"Double-click to edit."];
[theTableView reloadData];
[self updateChangeCount:NSChangeDone];
}
The array is "theItems" and its data is being presented in a TableView object. I understand that the steps here add a new string to the array and then refresh the table to display it, followed by setting the document to be set to an unsaved state.
What I am not getting is how one would know these specific steps and methods are required. Intuitively it seems one would just add items to the array, and that would be all that's required to have the new values simply show up in the table view for which the array is the data source, so how would one know that the tableView would need to be refreshed with the "reloadData" call? I can see someone (myself) figuring it out by trial and error, but is there some quick resource or guide (ie, some quick flow-chart) either in XCode or elsewhere that indicates for a table view that this would have to be a required action to display the new entry?
If I look at Apple's NSTableView class reference, it claims in the overview that you "modify the values in the data source and allow the changes to be reflected in the table view" which suggest the view is updated automatically, so the requirement to call "reloadData" on the view seems a little obscure.
Look for the guides. In the online class reference for NSTableView, there's a section at the top called "Companion Guides". For NSTableView, it lists the Table View Programming Guide for Mac. (In the prerelease 10.10 docs, the guides are listed under Related Documentation in the left-hand sidebar.)
I could have sworn this same information was available in Xcode's Documentation window, albeit somewhat hidden behind a "More related items" pseudo-link, but when I check right now there's no link to the guide anywhere in the NSTableView class reference. Which is a terrible oversight.
You can also browse or search the Guides section of the developer library.
Familiarity, studying the documentation and possibly reading some good books is the answer. For example, in the docs you quoted (emphasis mine)
you should modify the values in the data source and allow the changes to be reflected in the table view
You should do both these things. If you want it to happen "automatically", look into bindings, which uses several other Cocoa features you won't understand at this point either to do the table data source stuff for you. I'd recommend understanding what is happening manually before handing over control to bindings, so you have some chance of understanding when things go wrong.
As well as looking at the table view documentation, you also need to study the cell, delegate and datasource references. All of those objects work together to give you the functioning table view.

Class / object logic

How would you solve this? When the app starts, four objects of a class are created. These objects have names you know because you named them yourself. From a viewController you can access these objects and call a method (which they all got) which creates a UILocalNotification. (So in the end you've got four notifications running.)
Two questions:
How do you name the notifications (differently)? As far as I know is it not possible to access the object name to use the string as name when creating the notification? (Which would be the best solution?)
When the notifications are fired, how do you access/cancel them from another viewController when you don't know the names?
Thank you!
Set tags for all objects, and set same tags for notifications, they generate.

How to create an ics-File?

I want to make a app which can create a new event and send it to other persons.
So I thought it might be possible to create an ics-File of an EKEvent and send it away via email.
But I don't know how to create such a file from an EKEvent.
How does it work?
Thanks.
There are no methods of EKEvent which allows you to save it to file. The only way I see is to create file on your own, it should have VCalendar format. Just save event to file from iCal and see what it has inside.
I suppose I'm late, but... I found a category that converts an EKEvent to an .ics file. I haven't tested yet: https://github.com/mysterioustrousers/EKEventToiCal
Late answer:
The file format is defined here: http://www.ietf.org/rfc/rfc2445.txt Since this is the official definition, it is a long document.

how to udate window controls(NSTextField,NSCheckbox and etc) in binding manually

I am working on an application in which i need to store all the NSObject subclass properties into plist file and then allow users to store it and restore it. We call it profile and it can restore the saved state of all the controls/views on the window in my application.
I have completed the storing/Restoring part, but the issue is when i am updating the class properties manually, it is not updating the control state Like checkboxs and others which is bind with the class property.
Please let me know how can i update the controls state, if its KVC/KVO updated programatically.
Thanks in advance
You need to read this guide here
In particular read the section on "Automatic Versus Manual Support" which details how you need to change your properties so that you are KVO compliant.