{ "id": "86755", "key": "TIMOB-7724", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13407", "description": "Sprint 2012-11 API", "name": "Sprint 2012-11 API", "archived": true, "released": true, "releaseDate": "2012-06-03" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-05-24T11:09:49.000+0000", "created": "2012-02-21T14:07:29.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "qe-testadded" ], "versions": [ { "id": "13070", "description": "Release 1.8 Service Pack 2", "name": "Release 1.8.2", "archived": true, "released": true, "releaseDate": "2012-02-29" } ], "issuelinks": [ { "id": "17723", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "61867", "key": "TIMOB-1235", "fields": { "summary": "iOS: Missing KeyboardWillShow / KeyboardWillHide events", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-06-08T12:33:14.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "One should be able to know or detect the height/top of the keyboard. When keyboard is switched between different languages, one should know the height of the keyboard.", "attachment": [], "flagged": false, "summary": "iOS: the ability to get the cords for the top of the keyboard when it changes", "creator": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS5\r\nTiSDK 1.8.2", "comment": { "comments": [ { "id": "189616", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Requesting that we be able to get the coordinates of the top of the keyboard. This is especially important for the iPad. As of iOS 5 you can un-doc the keyboard from the bottom as well as move the keyboard up and down. So simply knowing the height of the keyboard will not help. It would be best if we could have an eventListener so that you can know when the keyboard is moved.\r\n\r\nIt would also be helpful if we could tell if the keyboard was split or not.", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-03T07:49:50.000+0000", "updated": "2012-04-03T07:49:50.000+0000" }, { "id": "190360", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I would like to submit a pull request for this, but I need to know if what I have is correct, syntax as well as code standards\r\n\r\nThis is the notification in AppModule.m\r\n{code}\r\n-(void)startup\r\n{\r\n\tWARN_IF_BACKGROUND_THREAD_OBJ;\t//NSNotificationCenter is not threadsafe!\r\n\t[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willShutdown:) name:kTiWillShutdownNotification object:nil];\r\n\t[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willShutdownContext:) name:kTiContextShutdownNotification object:nil];\r\n\t[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboard:) name:UIKeyboardWillHideNotification object:nil];\r\n\t[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboard:) name:UIKeyboardWillShowNotification object:nil];\r\n\t[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboard:) name:UIKeyboardDidHideNotification object:nil];\r\n\t[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboard:) name:UIKeyboardDidShowNotification object:nil];\r\n\tif([TiUtils isIOS5OrGreater] == YES)\r\n\t{\r\n\t\t\t[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboard:) name:UIKeyboardWillChangeFrameNotification object:nil];\r\n\t\t\t[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboard:) name:UIKeyboardDidChangeFrameNotification object:nil];\r\n\t}\r\n\t[super startup];\r\n}\r\n{code}\r\n\r\nAnd this is the event:\r\n{code}\r\n-(void)keyboard:(NSNotification *)notification\r\n{\r\n\tif ([self _hasListeners:@\"keyboard\"])\r\n\t{\r\n\t\t// Get the keyboard information\r\n\t\tNSDictionary *userInfo = [notification userInfo];\r\n\t\tNSString *notName = [notification name];\r\n\t\t// Get the begin and end rect values of the keyboard\r\n\t\tNSValue* beginValue = [userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey];\r\n\t\tNSValue* endValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];\r\n\r\n\t\tNSValue* currentValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];\r\n\r\n\t\tCGRect beginRect = [beginValue CGRectValue];\r\n\t\tCGRect endRect = [endValue CGRectValue];\r\n\r\n\t\t// Store the values of each rect in variables for orientation purposes\r\n\t\tCGFloat beginWidth = beginRect.size.width;\r\n\t\tCGFloat beginHeight = beginRect.size.height;\r\n\t\tCGFloat beginX = beginRect.origin.x;\r\n\t\tCGFloat beginY = beginRect.origin.y;\r\n\r\n\t\tCGFloat endWidth = endRect.size.width;\r\n\t\tCGFloat endHeight = endRect.size.height;\r\n\t\tCGFloat endX = endRect.origin.x;\r\n\t\tCGFloat endY = endRect.origin.y;\r\n\t\t\r\n\t\t// Check position of the screen, adjust rect accordingly\r\n\t\tif \t(\r\n\t\t\t[[UIApplication sharedApplication]statusBarOrientation] == UIDeviceOrientationLandscapeLeft ||\r\n\t\t\t[[UIApplication sharedApplication]statusBarOrientation] == UIDeviceOrientationLandscapeRight\r\n\t\t\t)\r\n\t\t{\r\n\t\t\tbeginRect.size.width = beginWidth;\r\n\t\t\tbeginRect.size.height = beginHeight;\r\n\t\t\tbeginRect.origin.x = beginY;\r\n\t\t\tbeginRect.origin.y = beginX;\r\n\r\n\t\t\tendRect.size.width = endWidth;\r\n\t\t\tendRect.size.height = endHeight;\r\n\t\t\tendRect.origin.x = endY;\r\n\t\t\tendRect.origin.y = endX;\r\n\r\n\t\t}\r\n\r\n\t\t// Create and NSDictionary with both rects\r\n\t\tNSDictionary *keyboardBeginRect = [NSDictionary dictionaryWithObjectsAndKeys:\r\n\t\t\t\t\t\t\t\t[NSNumber numberWithFloat:beginRect.size.width], @\"width\",\r\n\t\t\t\t\t\t\t\t[NSNumber numberWithFloat:beginRect.size.height], @\"height\",\r\n\t\t\t\t\t\t\t\t[NSNumber numberWithFloat:beginRect.origin.x], @\"x\",\r\n\t\t\t\t\t\t\t\t[NSNumber numberWithFloat:beginRect.origin.y], @\"y\",\r\n\t\t\t\t\t\t\t\tnil];\r\n\t\t\r\n\t\tNSDictionary *keyboardEndRect = [NSDictionary dictionaryWithObjectsAndKeys:\r\n\t\t\t\t\t\t\t\t[NSNumber numberWithFloat:endRect.size.width], @\"width\",\r\n\t\t\t\t\t\t\t\t[NSNumber numberWithFloat:endRect.size.height], @\"height\",\r\n\t\t\t\t\t\t\t\t[NSNumber numberWithFloat:endRect.origin.x], @\"x\",\r\n\t\t\t\t\t\t\t\t[NSNumber numberWithFloat:endRect.origin.y], @\"y\",\r\n\t\t\t\t\t\t\t\tnil];\r\n\t\t\t\t\t\t\t\t\r\n\t\tNSString *name = @\"\";\r\n\t\tif([notName isEqual: UIKeyboardWillShowNotification])\r\n\t\t \tname = @\"willShow\";\r\n\t\telse\r\n\t\tif([notName isEqual: UIKeyboardDidShowNotification])\r\n\t\t\t\tname = @\"didShow\";\r\n\t\telse\r\n\t\tif([notName isEqual: UIKeyboardWillHideNotification])\r\n\t\t \tname = @\"willHide\";\r\n\t\telse\r\n\t\tif([notName isEqual: UIKeyboardDidHideNotification])\r\n\t\t\t\tname = @\"didHide\";\t\r\n\t\telse\r\n\t\tif([TiUtils isIOS5OrGreater] == YES && [notName isEqual: UIKeyboardWillChangeFrameNotification])\r\n\t\t\t\tname = @\"willChange\";\r\n\t\telse\r\n\t\tif([TiUtils isIOS5OrGreater] == YES && [notName isEqual: UIKeyboardDidChangeFrameNotification])\r\n\t\t\t\tname = @\"didChange\";\r\n\t\telse\r\n\t\t\t\tname = notName;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t// Create the dictionary for the event\r\n\t\tNSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:\r\n\t\t\t\tname, @\"name\",\r\n\t\t\t\tkeyboardEndRect, @\"endRect\",\r\n\t\t\t\tkeyboardBeginRect, @\"beginRect\",\r\n\t\t\t\t[userInfo valueForKey:UIKeyboardAnimationCurveUserInfoKey], @\"animationCurve\",\r\n\t\t\t\t[userInfo valueForKey:UIKeyboardAnimationDurationUserInfoKey], @\"animationDuration\",\r\n\t\t\t\tnil];\r\n\t\t\t\t\r\n\t\t// Fire event\r\n\t\t[self fireEvent:@\"keyboard\" withObject:dict];\r\n\t}\r\n}\r\n{code}\r\n\r\n\r\nThe Javascript would be something like this:\r\n{code}\r\nTi.App.addEventListener('keyboard', function(e){\r\n\tvar name = e.name;\r\n\tvar bRect = e.beginRect;\r\n\tvar eRect = e.endRect;\r\n\tvar aCurve = e.animationCurve;\r\n\tvar aDuration = animationDuration;\r\n\r\n\tswitch(name){\r\n\t\tcase 'willShow':\r\n\t\t\t// some code\r\n\t\tbreak;\r\n\t\tcase 'didShow':\r\n\t\t\t// some code\r\n\t\tbreak;\r\n\t\tcase 'willHide':\r\n\t\t// some code\r\n\t\tbreak;\r\n\t\tcase 'didHide':\r\n\t\t\t// some code\r\n\t\tbreak;\r\n\r\n\t\t// iOS 5 - iPad\r\n\t\tcase 'willChange':\r\n\t\t\t// some code\r\n\t\tbreak;\r\n\t\tcase 'didChange':\r\n\t\t\t// some code\r\n\t\tbreak;\r\n\t}\r\n});\r\n{code}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-04-09T13:03:22.000+0000", "updated": "2012-04-09T13:06:04.000+0000" }, { "id": "195622", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Testing Code \r\n\r\n{code: tile:app.js|language:Javascript}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'white',\r\n exitOnClose: true,\r\n fullscreen: false,\r\n layout: 'vertical',\r\n title: 'KeyboardFrameChanged Demo'\r\n});\r\n\r\nvar textField = Ti.UI.createTextField({\r\n\tcolor: '#336699',\r\n\theight: 60,\r\n\ttop: 10,\r\n\tleft: 10,\r\n\twidth: 250,\r\n\tborderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED\r\n});\r\n\r\nwin.add(textField);\r\nTi.App.addEventListener('keyboardFrameChanged', function(e){\r\n\tTi.API.info(\"Keyboard Frame Size Changed\\n\");\r\n\tTi.API.info(\"X :\"+ e.keyboardFrame.x + \"\\ny:\"+e.keyboardFrame.y+\"\\nHeight:\"+e.keyboardFrame.height+\"\\nWidth:\"+e.keyboardFrame.width);\r\n}); \r\n\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-22T13:30:27.000+0000", "updated": "2012-05-22T13:30:27.000+0000" }, { "id": "195962", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Pull merged", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-24T11:09:49.000+0000", "updated": "2012-05-24T11:09:49.000+0000" }, { "id": "197574", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with iPad 3 5.1.1 and iPhone 3gs 4.3 ", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-06T14:35:12.000+0000", "updated": "2012-06-06T14:35:12.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }