Search results for

“SwiftData inheritance relationship”

4,982 results found

Post

Replies

Boosts

Views

Activity

Recommend a new view layout framework
iOS's Autolayout is an official view layout solution。AutoLayout through the veiw's constraint relationship to create the UI Layout。The disadvantage is that with the increase of UI elements, the complexity of the constraint will increase。 Here recommend MyLayout。MyLayout is a powerful iOS UI layout framework which is not an encapsulation based on the AutoLayout but is based on primary frame property and by overwriting the layoutSubview method to realize the subview's layout. So It is unlimited to run in any version of iOS system. Its idea and principle is referenced from the layout of the Android system, iOS AutoLayout and SizeClass. You can implement the UI layout through the six kinds of layout class below: MyLinearLayout, MyRelativeLayout, MyFrameLayout MyTableLayout, MyFlowLayout,MyFloatLayout and the support for SizeClass. You can visit my github project: https://github.com/youngsoft/MyLinearLayout to see more..
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
145
Jul ’16
Core Data: Best Technique to Sort To Many Relationship ordered set
Say I have a NSManagedObject subclass (Parent) with a to many relationship to another object (call the relationship children).To display children sorted, I could add a method like this to Parent:-(NSArray*)sortedChildren { NSArray *sorted = [self.children sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@key ascending:YES]]]; return sorted; }It would not be efficient to resort the children every time I need to access sortedChildren. I suppose I could keep a sorted copy in a property and override all the generated methods to add/insert children make sure the sorted array picks up changes....and nil it out in the didBecomeFault method? Is there a better way to do this? There can potentially be a lot of children so I do want to avoid a method like above.
2
0
1.2k
Jul ’16
iOS 10 RAW capture long exposure
Hi developers,I am new to the iOS and image processing and have some questions. I saw iOS 10 is going to support the RAW capture, and I wonder if this could make the real long exposure possible?It looks like the long exposure camera apps in the app store (i.e. slow shutter cam) are doing post-processing based several frames that are not RAW data. Therefore, the image is going to be effect by the post-processing inherit from Apple's algortihm and the compression of JPEG format, which is the part we can't control before iOS 10.As far as I know, RAW format is basicly everything that CMOS sensor captures (which I assumes to be RGB energy intensities). If we have the several frames of RAWs, I wonder if it is closer to have a real long exposure by summing the intensitiies as what we do in phyiscally long exposure? Thanks.
2
0
1.9k
Jul ’16
Reply to CoreData: Setting NSFetchRequest resultType to NSManagedObjectIDResultType and then NSDictionaryResultType does not work anymore
Sorry by the screenshot of the Core Data model for the test was not uploaded, it's like:EntityA- Attributes entityAValue (String)- Relationships entitiesB (Destination EntityB, ToMany)EntityB- Relationships entityA (Destination EntityA, ToMany) entityC (Destination EntityC, ToOne)EntityA- Attributes entityCValue (String)- Relationships entitiesB (Destination EntityB, ToMany)
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’16
Slow save after changing Core Data relationship validation rule
In Xcode on my data model, I created a new version and just modified a relationship to be optional (instead of non-optional).Running my updated app with a large database created using previous model version will cause the first save to run really slow. This happens after each app launch!If I build a large database from scratch using my updated app (means, using new model version) there will be no issue.Note that I modified the relationship on an entity holding an image data (blob).Any thoughts?
1
0
2.4k
Jul ’16
Reply to KVO and XIB file madness
The trouble is that the status of the NIB isn't relevant. The NIB file is an archive of the various objects that make up that piece of your UI. When loading happens (the process that ends with viewDidLoad being invoked), the objects are unarchived, their inter-relationships (i.e. outlets) are re-established, and they are then independent of the NIB. The NIB no longer needs to be around.So, if you want to break down the inter-relationships between objects that originated in the NIB, you have to do that programmatically.However, that is not your situation. The troublesome part of your scenario is the relationship between the plugin view controller and the window controller, which is something to establish separately from the NIB. (You said the window controller passes a reference to itself to the plugin.) Because you established this manually, you need to get rid of it manually. You have several choices about how to do so, including at least:1. In your plugin's didUnload, you can set
Topic: UI Frameworks SubTopic: AppKit Tags:
Jul ’16
removeFromSuperView not working with UITextView
I am trying to use removeFromSuperView with a UITextView Object but it is giving me the following error: No visible @interface for 'UITextField' declares the selector 'removeFromSuperView'This seems strange since UITextField is a subclass of UIView, so it should inherit the removeFromSuperView method. I have tried the same method for buttons and it works great. Here is how I am calling it: [self.exitButton removeFromSuperview]; [self.teacherText removeFromSuperView];I set up my UITextField programmatically, it is declared as follows: in .h: @property(nonatomic, copy) UITextField *teacherText; in viewDidLoad of .m: _teacherText = [[UITextField alloc] initWithFrame:CGRectMake(45, 30, 200, 40)]; _teacherText.textColor = [UIColor colorWithRed:0/256.0 green:84/256.0 blue:129/256.0 alpha:1.0]; _teacherText.font = [UIFont fontWithName:@Helvetica-Bold size:25]; _teacherText.backgroundColor=[UIColor whiteColor]; _teacherText.text=@Hello World; [self.view addSubview:_exitButton];Is there anything I am missing?
1
0
1.5k
Jul ’16
SiriRemote touchesEnded called, value change handler NOT
I have a UIViewController which inherits from GCEventViewController and I register a value change handler for the GCController microPad Profile.But when I use the SiriRemote in the Simulator none of my handling methods is called. When I stop with the touches the touchesEnded function is called though on that particular view controller.This is are excerpts of my code: var gameController : GCController? { get { return self.currentGameController } set(v) { self.currentGameController = v self.controllerUserInteractionEnabled = false if let microPad = v!.microGamepad { microPad.allowsRotation = false microPad.reportsAbsoluteDpadValues = true microPad.valueChangedHandler = self.microPadValueChangeHandler } } } ... override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { log.info(||||| TOUCHES ENDED IN GAMEVIEW_CONTROLLER |||||.) } func microPadValueChangeHandler( _ gp : GCMicroGamepad , _ gc : GCControllerElement ) { log.info(||||||||| microPadValueChangeHandler ||||||) log.info(||
1
0
282
Jul ’16
Reply to migrating common code to one place
We are getting into object oriented design philosophy here. Describe what those routines do in natural language. If the relationship between your two UIViews and the common stuff is is a, use inheritance to make your two UIView subclasses extend from a common base class. If it's has a, use composition - move the common functionality into a separate class, an instance of which each of your two UIViews would contain.
Jul ’16
Reply to macOS NSTextStorage -> NSLayoutManager lazy attribute applying
What is the high-level goal you're trying to achieve? What do you mean by background attribute change and why do you want to enable it?It looks to me like fixesAttributesLazily is not about background fixing of attributes, but lazy fixing. That is, the fixing is deferred until something queries the attributes, at which point it's done on demand but still synchronously.So, edited(_:range:changeInLength:) and endEditing() will call processEditing(). processEditing() will call invalidateAttributesInRange(). If fixesAttributesLazily is false, that will call fixAttributesInRange() (inherited from NSMutableAttributedString) and the attributes will be immediately fixed.However, a subclass can arrange to be safe for lazy fixing of attributes by making sure all of its attribute-accessing methods (overrides of methods inherited from NSMutableAttributedString and NSAttributedString) call ensureAttributesAreFixedInRange() before actually accessing them. If it does this, it can also override fixesAttribu
Topic: UI Frameworks SubTopic: AppKit Tags:
Jul ’16
Segues initiated directly from view controllers must have an identifier
My app runs fine but I've got a warning in Xcode 7.3.1 that says:Segues initiated directly from view controllers must have an identifierOn my storyboard and also in my code all segues have identifiersIf I double click it takes me to the end of the source code for the view controller. There is no mention of segue there..If I search the source code the only segue I see without an identifier is on the root view controller… Any Ideas?Thanks!<scene sceneID=9W3-l5-iKf> <objects> <navigationController automaticallyAdjustsScrollViewInsets=NO id=CIC-k8-VJ6 sceneMemberID=viewController> <toolbarItems/> <navigationBar key=navigationBar contentMode=scaleToFill id=fS8-Bl-fda> <rect key=frame x=0.0 y=0.0 width=320 height=44/> <autoresizingMask key=autoresizingMask/> </navigationBar> <nil name=viewControllers/> <connections> <segue destination=BYZ-38-t0r kind=relationship relationship=rootViewController id=3Fr-zs-F5x/> </connections> &
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
2.1k
Jul ’16
Reply to KVO and XIB file madness
Apologies for being late on replying. I've been out of town on business.To your points:- I'm using Objective-C.- Good point about self being in the key path. I've taken it out.- Yes, PropertiesPlugIn is the File's Owner of the NIB that it loads.- The declaration of the 'controller' property is as follows:@property (weak) WSSiteWindowController *controller;Every subclass of WSPlugIn (which itself is a sublcass of NSViewcontroller) inherits this property. (It is not an instance variable as I first indicated, so I apologize for the misrepresentation.)It is weak because if it were strong, a retain cycle would ensue (the WSSiteWindowController object holds a strong reference to a WSPlugInManager, which itself holds a strong reference to an NSArray of WSPlugIns, of which PropertiesPlugIn is one).It may help if I outline the relationships here:- WSSiteWindowController creates an WSPlugInManager (and has a strong reference to it) and passes 'self' to it at init time.- WSPlugInManager holds onto the
Topic: UI Frameworks SubTopic: AppKit Tags:
Jul ’16
Recommend a new view layout framework
iOS's Autolayout is an official view layout solution。AutoLayout through the veiw's constraint relationship to create the UI Layout。The disadvantage is that with the increase of UI elements, the complexity of the constraint will increase。 Here recommend MyLayout。MyLayout is a powerful iOS UI layout framework which is not an encapsulation based on the AutoLayout but is based on primary frame property and by overwriting the layoutSubview method to realize the subview's layout. So It is unlimited to run in any version of iOS system. Its idea and principle is referenced from the layout of the Android system, iOS AutoLayout and SizeClass. You can implement the UI layout through the six kinds of layout class below: MyLinearLayout, MyRelativeLayout, MyFrameLayout MyTableLayout, MyFlowLayout,MyFloatLayout and the support for SizeClass. You can visit my github project: https://github.com/youngsoft/MyLinearLayout to see more..
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
0
Boosts
0
Views
145
Activity
Jul ’16
Core Data: Best Technique to Sort To Many Relationship ordered set
Say I have a NSManagedObject subclass (Parent) with a to many relationship to another object (call the relationship children).To display children sorted, I could add a method like this to Parent:-(NSArray*)sortedChildren { NSArray *sorted = [self.children sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@key ascending:YES]]]; return sorted; }It would not be efficient to resort the children every time I need to access sortedChildren. I suppose I could keep a sorted copy in a property and override all the generated methods to add/insert children make sure the sorted array picks up changes....and nil it out in the didBecomeFault method? Is there a better way to do this? There can potentially be a lot of children so I do want to avoid a method like above.
Replies
2
Boosts
0
Views
1.2k
Activity
Jul ’16
iOS 10 RAW capture long exposure
Hi developers,I am new to the iOS and image processing and have some questions. I saw iOS 10 is going to support the RAW capture, and I wonder if this could make the real long exposure possible?It looks like the long exposure camera apps in the app store (i.e. slow shutter cam) are doing post-processing based several frames that are not RAW data. Therefore, the image is going to be effect by the post-processing inherit from Apple's algortihm and the compression of JPEG format, which is the part we can't control before iOS 10.As far as I know, RAW format is basicly everything that CMOS sensor captures (which I assumes to be RGB energy intensities). If we have the several frames of RAWs, I wonder if it is closer to have a real long exposure by summing the intensitiies as what we do in phyiscally long exposure? Thanks.
Replies
2
Boosts
0
Views
1.9k
Activity
Jul ’16
Reply to Learning Core Data sanity check
I'm not sure if I'd use Core data to do a questionaiire app like this..how many questions are in the survey? You could create relationships between entities, so you don't have to store everything as attributes.
Replies
Boosts
Views
Activity
Jul ’16
Reply to CoreData: Setting NSFetchRequest resultType to NSManagedObjectIDResultType and then NSDictionaryResultType does not work anymore
Sorry by the screenshot of the Core Data model for the test was not uploaded, it's like:EntityA- Attributes entityAValue (String)- Relationships entitiesB (Destination EntityB, ToMany)EntityB- Relationships entityA (Destination EntityA, ToMany) entityC (Destination EntityC, ToOne)EntityA- Attributes entityCValue (String)- Relationships entitiesB (Destination EntityB, ToMany)
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’16
Slow save after changing Core Data relationship validation rule
In Xcode on my data model, I created a new version and just modified a relationship to be optional (instead of non-optional).Running my updated app with a large database created using previous model version will cause the first save to run really slow. This happens after each app launch!If I build a large database from scratch using my updated app (means, using new model version) there will be no issue.Note that I modified the relationship on an entity holding an image data (blob).Any thoughts?
Replies
1
Boosts
0
Views
2.4k
Activity
Jul ’16
Reply to Learning Core Data sanity check
You could create an entity for questions, too. Then you make a relationship between these entities as already mentioned. In the question entity you can now create a Boolean attribute which you could use in your code. Hope this helps.
Replies
Boosts
Views
Activity
Jul ’16
Reply to KVO and XIB file madness
The trouble is that the status of the NIB isn't relevant. The NIB file is an archive of the various objects that make up that piece of your UI. When loading happens (the process that ends with viewDidLoad being invoked), the objects are unarchived, their inter-relationships (i.e. outlets) are re-established, and they are then independent of the NIB. The NIB no longer needs to be around.So, if you want to break down the inter-relationships between objects that originated in the NIB, you have to do that programmatically.However, that is not your situation. The troublesome part of your scenario is the relationship between the plugin view controller and the window controller, which is something to establish separately from the NIB. (You said the window controller passes a reference to itself to the plugin.) Because you established this manually, you need to get rid of it manually. You have several choices about how to do so, including at least:1. In your plugin's didUnload, you can set
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jul ’16
removeFromSuperView not working with UITextView
I am trying to use removeFromSuperView with a UITextView Object but it is giving me the following error: No visible @interface for 'UITextField' declares the selector 'removeFromSuperView'This seems strange since UITextField is a subclass of UIView, so it should inherit the removeFromSuperView method. I have tried the same method for buttons and it works great. Here is how I am calling it: [self.exitButton removeFromSuperview]; [self.teacherText removeFromSuperView];I set up my UITextField programmatically, it is declared as follows: in .h: @property(nonatomic, copy) UITextField *teacherText; in viewDidLoad of .m: _teacherText = [[UITextField alloc] initWithFrame:CGRectMake(45, 30, 200, 40)]; _teacherText.textColor = [UIColor colorWithRed:0/256.0 green:84/256.0 blue:129/256.0 alpha:1.0]; _teacherText.font = [UIFont fontWithName:@Helvetica-Bold size:25]; _teacherText.backgroundColor=[UIColor whiteColor]; _teacherText.text=@Hello World; [self.view addSubview:_exitButton];Is there anything I am missing?
Replies
1
Boosts
0
Views
1.5k
Activity
Jul ’16
SiriRemote touchesEnded called, value change handler NOT
I have a UIViewController which inherits from GCEventViewController and I register a value change handler for the GCController microPad Profile.But when I use the SiriRemote in the Simulator none of my handling methods is called. When I stop with the touches the touchesEnded function is called though on that particular view controller.This is are excerpts of my code: var gameController : GCController? { get { return self.currentGameController } set(v) { self.currentGameController = v self.controllerUserInteractionEnabled = false if let microPad = v!.microGamepad { microPad.allowsRotation = false microPad.reportsAbsoluteDpadValues = true microPad.valueChangedHandler = self.microPadValueChangeHandler } } } ... override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { log.info(||||| TOUCHES ENDED IN GAMEVIEW_CONTROLLER |||||.) } func microPadValueChangeHandler( _ gp : GCMicroGamepad , _ gc : GCControllerElement ) { log.info(||||||||| microPadValueChangeHandler ||||||) log.info(||
Replies
1
Boosts
0
Views
282
Activity
Jul ’16
Reply to Bug: A managed object relationship that contains multiple copies of the same object.
I have similar scenario and the same problem on iOS 9, too. Did you find any fix meanwhile? Or at least an explanation?P.S. In my case the relationship is one-to-one:parentEntity <-> childEntityI end up with 2 duplicated children having the same parent (one has temporaryID, the other permanent)
Replies
Boosts
Views
Activity
Jul ’16
Reply to migrating common code to one place
We are getting into object oriented design philosophy here. Describe what those routines do in natural language. If the relationship between your two UIViews and the common stuff is is a, use inheritance to make your two UIView subclasses extend from a common base class. If it's has a, use composition - move the common functionality into a separate class, an instance of which each of your two UIViews would contain.
Replies
Boosts
Views
Activity
Jul ’16
Reply to macOS NSTextStorage -> NSLayoutManager lazy attribute applying
What is the high-level goal you're trying to achieve? What do you mean by background attribute change and why do you want to enable it?It looks to me like fixesAttributesLazily is not about background fixing of attributes, but lazy fixing. That is, the fixing is deferred until something queries the attributes, at which point it's done on demand but still synchronously.So, edited(_:range:changeInLength:) and endEditing() will call processEditing(). processEditing() will call invalidateAttributesInRange(). If fixesAttributesLazily is false, that will call fixAttributesInRange() (inherited from NSMutableAttributedString) and the attributes will be immediately fixed.However, a subclass can arrange to be safe for lazy fixing of attributes by making sure all of its attribute-accessing methods (overrides of methods inherited from NSMutableAttributedString and NSAttributedString) call ensureAttributesAreFixedInRange() before actually accessing them. If it does this, it can also override fixesAttribu
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jul ’16
Segues initiated directly from view controllers must have an identifier
My app runs fine but I've got a warning in Xcode 7.3.1 that says:Segues initiated directly from view controllers must have an identifierOn my storyboard and also in my code all segues have identifiersIf I double click it takes me to the end of the source code for the view controller. There is no mention of segue there..If I search the source code the only segue I see without an identifier is on the root view controller… Any Ideas?Thanks!<scene sceneID=9W3-l5-iKf> <objects> <navigationController automaticallyAdjustsScrollViewInsets=NO id=CIC-k8-VJ6 sceneMemberID=viewController> <toolbarItems/> <navigationBar key=navigationBar contentMode=scaleToFill id=fS8-Bl-fda> <rect key=frame x=0.0 y=0.0 width=320 height=44/> <autoresizingMask key=autoresizingMask/> </navigationBar> <nil name=viewControllers/> <connections> <segue destination=BYZ-38-t0r kind=relationship relationship=rootViewController id=3Fr-zs-F5x/> </connections> &
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
0
Boosts
0
Views
2.1k
Activity
Jul ’16
Reply to KVO and XIB file madness
Apologies for being late on replying. I've been out of town on business.To your points:- I'm using Objective-C.- Good point about self being in the key path. I've taken it out.- Yes, PropertiesPlugIn is the File's Owner of the NIB that it loads.- The declaration of the 'controller' property is as follows:@property (weak) WSSiteWindowController *controller;Every subclass of WSPlugIn (which itself is a sublcass of NSViewcontroller) inherits this property. (It is not an instance variable as I first indicated, so I apologize for the misrepresentation.)It is weak because if it were strong, a retain cycle would ensue (the WSSiteWindowController object holds a strong reference to a WSPlugInManager, which itself holds a strong reference to an NSArray of WSPlugIns, of which PropertiesPlugIn is one).It may help if I outline the relationships here:- WSSiteWindowController creates an WSPlugInManager (and has a strong reference to it) and passes 'self' to it at init time.- WSPlugInManager holds onto the
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jul ’16